[llvm-bugs] [Bug 45761] New: Failure to optimize arithmetic around abs

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 30 11:49:36 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200430/afb18ae8/attachment.html>


More information about the llvm-bugs mailing list