[llvm-bugs] [Bug 45774] New: Failure to optimize followed xors into seperate xors to avoid mov

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 1 15:51:17 PDT 2020


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

            Bug ID: 45774
           Summary: Failure to optimize followed xors into seperate xors
                    to avoid mov
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

int f(int x, int y, int c)
{
    return (x - y - c) ^ x ^ y;
}

With -O3, GCC outputs this :

f:
  mov eax, edi
  xor edi, esi
  sub eax, esi
  sub eax, edx
  xor eax, edi
  ret

Clang outputs this :

f:
  mov eax, esi
  mov ecx, edi
  sub ecx, esi
  sub ecx, edx
  xor eax, edi
  xor eax, ecx
  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/20200501/151825d9/attachment.html>


More information about the llvm-bugs mailing list