[llvm-bugs] [Bug 31667] New: inefficient code for i16 bit

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 17 01:01:24 PST 2017


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

            Bug ID: 31667
           Summary: inefficient code for i16 bit
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: asaf.badouh at intel.com
          Reporter: asaf.badouh at intel.com
                CC: amjad.aboud at intel.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Given:
define i16 @test(i16 %data) {
entry:
  %shr1 = lshr i16 %data, 1
  %shr1.1 = lshr i16 %data, 3
  %ret = sub i16 %shr1.1, %shr1
  ret i16 %ret
}

Generated asm:
movl    %ecx, %eax
andl    $65528, %eax  # imm = 0xFFF8
andl    $65534, %ecx  # imm = 0xFFFE
shrl    %ecx
shrl    $3, %eax
subl    %ecx, %eax
retq

The optimal expected asm:
andl    $65535, %eax  # imm = 0xFFFF
movl    %eax, %ecx
shrl    %ecx
shrl    $3, %eax
subl    %ecx, %eax
retq

-- 
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/20170117/ce5fd31c/attachment.html>


More information about the llvm-bugs mailing list