[LLVMbugs] [Bug 15627] New: X86 CodeGen: Vector code for shift right could be better?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 29 14:42:09 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15627

            Bug ID: 15627
           Summary: X86 CodeGen: Vector code for shift right could be
                    better?
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: aschwaighofer at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#define TYPE unsigned int 
#define OP >>
#define SIZE 1024

#define TYPE_ALIGN __attribute__((aligned(16)))

TYPE A1[SIZE] TYPE_ALIGN;
TYPE B1[SIZE] TYPE_ALIGN;
TYPE C1[SIZE] TYPE_ALIGN;
TYPE D1[SIZE] TYPE_ALIGN;


void kernel1(int x) {
  for (int i = 0; i < SIZE; ++i) {
    //A1[i] = B1[i] OP C1[i];
    A1[i] = B1[i] OP x;
  }
}

Couldn't we use psrlw instead of the scalarized shr.'s?

cat > testshr.ll

define <4 x i32> @test_shr(<4 x i32> %a, <4 x i32> %b) {
  %1 = lshr <4 x i32> %a, %b
  ret <4 x i32> %1
}
----

llc testshr.ll -o - -mcpu=core2 -mtriple=x86_64-apple-macosx10.8.0




## BB#0:
        pshufd  $3, %xmm0, %xmm2        ## xmm2 = xmm0[3,0,0,0]
        movd    %xmm2, %edx
        pshufd  $3, %xmm1, %xmm2        ## xmm2 = xmm1[3,0,0,0]
        movd    %xmm2, %ecx
                                        ## kill: CL<def> CL<kill> ECX<kill>
        shrl    %cl, %edx
        movd    %xmm0, %eax
        movd    %xmm1, %ecx
                                        ## kill: CL<def> CL<kill> ECX<kill>
        shrl    %cl, %eax
        movd    %edx, %xmm2
        pshufd  $1, %xmm0, %xmm3        ## xmm3 = xmm0[1,0,0,0]
        movd    %xmm3, %edx
        pshufd  $1, %xmm1, %xmm3        ## xmm3 = xmm1[1,0,0,0]
        movd    %xmm3, %ecx
                                        ## kill: CL<def> CL<kill> ECX<kill>
        shrl    %cl, %edx
        movd    %edx, %xmm3
        punpckldq       %xmm2, %xmm3    ## xmm3 =
xmm3[0],xmm2[0],xmm3[1],xmm2[1]
        movd    %eax, %xmm2
        movhlps %xmm0, %xmm0            ## xmm0 = xmm0[1,1]
        movd    %xmm0, %eax
        movhlps %xmm1, %xmm1            ## xmm1 = xmm1[1,1]
        movd    %xmm1, %ecx
                                        ## kill: CL<def> CL<kill> ECX<kill>
        shrl    %cl, %eax
        movd    %eax, %xmm0
        punpckldq       %xmm0, %xmm2    ## xmm2 =
xmm2[0],xmm0[0],xmm2[1],xmm0[1]
        punpckldq       %xmm3, %xmm2    ## xmm2 =
xmm2[0],xmm3[0],xmm2[1],xmm3[1]
        movdqa  %xmm2, %xmm0
        ret

-- 
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/20130329/690a13c1/attachment.html>


More information about the llvm-bugs mailing list