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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

#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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to