<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][SSE] LLVM produces sub-optimal assembly for zext from 8xi8 to 8xi32"
   href="https://llvm.org/bugs/show_bug.cgi?id=25718">25718</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86][SSE] LLVM produces sub-optimal assembly for zext from 8xi8 to 8xi32
          </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>Linux
          </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>congh@google.com
          </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>For the following IR:

define void @zext_v8i8_to_v8i32(<8 x i8>* %a) {
  %1 = load <8 x i8>, <8 x i8>* %a
  %2 = zext <8 x i8> %1 to <8 x i32>
  store <8 x i32> %2, <8 x i32>* undef, align 4
  ret void
}

LLVM emits the following assembly:


movq    (%rdi), %xmm0           # xmm0 = mem[0],zero
punpcklbw    %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
movdqa    %xmm0, %xmm1
punpcklwd    %xmm0, %xmm1    # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movdqa    .LCPI0_0(%rip), %xmm2   # xmm2 =
[255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
pand    %xmm2, %xmm1
punpckhwd    %xmm0, %xmm0    # xmm0 = xmm0[4,4,5,5,6,6,7,7]
pand    %xmm2, %xmm0
movdqu    %xmm0, (%rax)
movdqu    %xmm1, (%rax)
retq

This is sub-optimal as we can eliminate two pand and one movdaq by using zeros
as one operand on all punpck*** (so we have one more xor).</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>