<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - X86 CodeGen: Vector code for shift right could be better?"
   href="http://llvm.org/bugs/show_bug.cgi?id=15627">15627</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86 CodeGen: Vector code for shift right could be better?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aschwaighofer@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>