<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 --- - Vector shuffle punpck+pshufb+punpck+pshufb should be just a single pshufb"
   href="http://llvm.org/bugs/show_bug.cgi?id=22415">22415</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Vector shuffle punpck+pshufb+punpck+pshufb should be just a single pshufb
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>grosbach@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>Created <span class=""><a href="attachment.cgi?id=13786" name="attach_13786" title="Test case.">attachment 13786</a> <a href="attachment.cgi?id=13786&action=edit" title="Test case.">[details]</a></span>
Test case.

#include <simd/simd.h>                                                          

vector_char4 bar(vector_short4 x) { return ((vector_char8)x).even; }            
vector_char3 baz(vector_short3 x) { return bar(x.xyzz).xyz; }

Generates the shuffle sequence for baz() as:
    punpcklwd    %xmm0, %xmm0    ## xmm0 = xmm0[0,0,1,1,2,2,3,3]
    pshufb    LCPI1_0(%rip), %xmm0    ## xmm0 =
xmm0[0,1,4,5,8,9,8,9,8,9,8,9,8,9,10,11]
    movd    %xmm0, %rax
    movd    %rax, %xmm0
    punpcklbw    %xmm0, %xmm0    ## xmm0 =
xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
    pshufb    LCPI1_1(%rip), %xmm0    ## xmm0 =
xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]

The operation can be done instead in a single pshufb.

IR attached.</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>