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: unassignedb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: fil...@gmail.com, llvm-bugs@lists.llvm.org,
                    spatel+l...@rotateright.com, til...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to