[llvm-bugs] [Bug 45755] New: Failure to recognize andn-like pattern

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 30 04:53:25 PDT 2020


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

            Bug ID: 45755
           Summary: Failure to recognize andn-like pattern
           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)
{
    return ~(x | -x);
}

With -O3, GCC outputs this :

f(int):
  lea eax, [rdi-1]
  andn eax, edi, eax
  ret

LLVM outputs this : 

f(int): # @f(int)
  mov eax, edi
  neg eax
  or eax, edi
  not 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/341c8d49/attachment.html>


More information about the llvm-bugs mailing list