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

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

Reply via email to