[llvm-bugs] [Bug 43515] New: trunc(x >> (bitwidth-1)) ^ 1 is not recognized as bt+setae

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 30 14:51:55 PDT 2019


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

            Bug ID: 43515
           Summary: trunc(x >> (bitwidth-1)) ^ 1 is not recognized as
                    bt+setae
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri 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

https://godbolt.org/z/jUiaJg

If we start with
int cmpge32_0(long a) {
  return a>=0;
}
We get
        shr     rax, 63
        xor     eax, 1

But for less canonical 
  %n0 = and i64 %x, 9223372036854775808 # sign bit mask
  %n1 = icmp eq i64 %n0, 0
  %r = zext i1 %n1 to i32 

we get seemingly-more-optimal
        xor     eax, eax
        bt      rdi, 63
        setae   al

-- 
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/20190930/019ae39e/attachment.html>


More information about the llvm-bugs mailing list