[llvm-bugs] [Bug 47051] New: ~(~X + Y) -> X - Y

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 8 03:52:00 PDT 2020


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

            Bug ID: 47051
           Summary: ~(~X + Y) -> X - Y
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

LLVM should implement simplification ~(~X + Y) -> X - Y.


int bad (int x, int y)
{
  return ~(~x + y);
}

Clang:
bad(int, int):                               # @bad(int, int)
        not     edi
        lea     eax, [rdi + rsi]
        not     eax
        ret

GCC:
bad(int, int):
        mov     eax, edi
        sub     eax, esi
        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/20200808/d3d076ce/attachment-0001.html>


More information about the llvm-bugs mailing list