[LLVMbugs] [Bug 10037] New: Poor code generated for whole-vector shifts

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 27 08:33:13 PDT 2011


           Summary: Poor code generated for whole-vector shifts
           Product: new-bugs
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu

Consider this:

define <4 x i32> @lshr(<4 x i32> %x) {
  %a = bitcast <4 x i32> %x to i128
  %b = lshr i128 %a, 32
  %c = bitcast i128 %b to <4 x i32>
  ret <4 x i32> %c

it codegens to:

        movd    %xmm0, %rcx
        pextrq  $1, %xmm0, %rax
        shrdq   $32, %rax, %rcx
        movd    %rcx, %xmm0
        shrq    $32, %rax
        movd    %rax, %xmm1
        punpcklqdq      %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]

however it could codegen to a simple
since the shift is by a multiple of 8.

The best way to solve this might be to turn this construct into a shufflevector
at the IR level.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list