[llvm-bugs] [Bug 39475] New: Failure to simplify -std::abs(a) <= 0

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 29 06:45:38 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39475

            Bug ID: 39475
           Summary: Failure to simplify -std::abs(a) <= 0
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: filcab at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com, tilkax at gmail.com

#include <algorithm>

bool bar(int a)
{
    return -std::abs(a) <= 0;
}

https://godbolt.org/z/8CYqjj

clang:

_Z3bari: # @_Z3bari
  movl %edi, %eax
  negl %eax
  testl %edi, %edi
  cmovsl %edi, %eax
  testl %eax, %eax
  setle %al
  retq

gcc:

_Z3bari:
  movl $1, %eax
  ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181029/2e8963d5/attachment.html>


More information about the llvm-bugs mailing list