[llvm-bugs] [Bug 39840] New: [x86] unnecessary clearing of bits with 16-bit value

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 29 12:01:07 PST 2018


            Bug ID: 39840
           Summary: [x86] unnecessary clearing of bits with 16-bit value
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

As discussed here:

We have this regression test in:

define i16 @clear_lowbits16_ic0(i16 %val, i16 %numlowbits) nounwind {
  %numhighbits = sub i16 16, %numlowbits
  %mask = shl i16 -1, %numhighbits
  %masked = and i16 %mask, %val
  ret i16 %masked

$ llc -o - lowbits.ll
        movzwl  %di, %eax   <--- don't need this
        movl    $16, %ecx
        subl    %esi, %ecx
        shrl    %cl, %eax
        shll    %cl, %eax

(Note that D54640 will modify that output slightly, but not the leading

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/20181129/ff095bca/attachment.html>

More information about the llvm-bugs mailing list