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

            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: unassignedb...@nondot.org
          Reporter: spatel+l...@rotateright.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@rotateright.com

As discussed here:
https://reviews.llvm.org/D54640

We have this regression test in:
test/CodeGen/X86/clear-lowbits.ll

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
        retq

(Note that D54640 will modify that output slightly, but not the leading
'movzwl'.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to