<html>
    <head>
      <base href="https://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 backend should prefer pinsrw over movzwl + movd?"
   href="https://llvm.org/bugs/show_bug.cgi?id=31287">31287</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>x86 backend should prefer pinsrw over movzwl + movd?
          </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>Windows NT
          </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>efriedma@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Take a testcase like the following:

define <16 x i8> @f(<2 x i8> *%p) {
  %t = load <2 x i8>, <2 x i8> *%p
  %r = shufflevector <2 x i8> %t, <2 x i8> undef, <16 x i32> <i32 0, i32 1, i32
2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2,
i32 2, i32 2>
  ret <16 x i8> %r
}

Using "llc -mtriple=x86_64-pc-linux-gnu -mattr=+avx", we generate:

        movzwl  (%rdi), %eax
        vmovd   %eax, %xmm0
        retq

Potential alternate sequence, which I expect is a little faster (not tested):
        vpxor   %xmm0, %xmm0, %xmm0
        vpinsrw $0, (%rdi), %xmm0, %xmm0
        retq</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>