[llvm-bugs] [Bug 42314] New: Missed BLSR for x == (x & -x) && x

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 18 18:23:02 PDT 2019


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

            Bug ID: 42314
           Summary: Missed BLSR for x == (x & -x) && x
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

bool blsr (int x)
{
  return x == (x & -x) && x;
}


Trunk -O3 -march=haswell
blsr(int):                              
        mov     eax, edi
        neg     eax
        setb    cl
        andn    eax, eax, edi
        sete    al
        and     al, cl
        ret

GCC -O3 -march=haswell                           
blsr(int):
        blsr    eax, edi
        sete    al
        test    edi, edi
        setne   dl
        and     eax, edx
        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/20190619/79ffedaf/attachment.html>


More information about the llvm-bugs mailing list