[llvm-bugs] [Bug 40060] New: [X86] optimizeCompareInstr can use the S flag from the BEXTR instruction which is undefined

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 17 19:31:06 PST 2018


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

            Bug ID: 40060
           Summary: [X86] optimizeCompareInstr can use the S flag from the
                    BEXTR instruction which is undefined
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: craig.topper 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

With BMI1 this code will use the BEXTR instruction and use the S flag from the
BEXTR instruction directly. But BEXTR doesn't update the S flag with a
meaningful value.

define dso_local void @_Z3foojj(i32, i32) local_unnamed_addr #0 {
  %3 = sub i32 32, %1
  %4 = lshr i32 -1, %3
  %5 = and i32 %4, %0
  %6 = icmp sgt i32 %5, -1
  br i1 %6, label %7, label %8

  tail call void @_Z3barv()
  br label %8

  ret void
}

Output

foo(unsigned int, unsigned int):                               # @foo(unsigned
int, unsigned int)
        shl     esi, 8
        bextr   eax, edi, esi
        js      .LBB0_1
        jmp     bar()                 # TAILCALL
.LBB0_1:
        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/20181218/de637281/attachment.html>


More information about the llvm-bugs mailing list