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

            Bug ID: 45761
           Summary: Failure to optimize arithmetic around abs
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: unassignedb...@nondot.org
          Reporter: gabrav...@gmail.com
                CC: llvm-bugs@lists.llvm.org

#define abs __builtin_abs

int f(int x, int y)
{
    return abs(x - y + (int)0x80000000);
}

With -O3, GCC outputs this :

f(int, int):
  sub esi, edi
  lea eax, [rsi-2147483648]
  ret

LLVM outputs this :

f(int, int): # @f(int, int)
  mov eax, edi
  sub eax, esi
  or eax, -2147483648
  neg 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
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to