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.bad...@intel.com
          Reporter: asaf.bad...@intel.com
                CC: amjad.ab...@intel.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to