<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [SLP] Missing vectorization"
   href="https://bugs.llvm.org/show_bug.cgi?id=47623">47623</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SLP] Missing vectorization
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.bolvansky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>int a[8], b[8];

void foo(void)
{
  a[0] = b[0];
  a[1] = b[2];
  a[2] = b[0];
  a[3] = b[2];
  a[4] = b[0];
  a[5] = b[2];
  a[6] = b[0];
  a[7] = b[2];
}

Clang:
foo():                                # @foo()
        mov     eax, dword ptr [rip + b]
        mov     dword ptr [rip + a], eax
        mov     ecx, dword ptr [rip + b+8]
        mov     dword ptr [rip + a+4], ecx
        mov     dword ptr [rip + a+8], eax
        mov     dword ptr [rip + a+12], ecx
        mov     dword ptr [rip + a+16], eax
        mov     dword ptr [rip + a+20], ecx
        mov     dword ptr [rip + a+24], eax
        mov     dword ptr [rip + a+28], ecx
        ret
a:
        .zero   32

b:
        .zero   32

GCC:
foo():
        movd    xmm0, DWORD PTR b[rip]
        movd    xmm1, DWORD PTR b[rip+8]
        punpckldq       xmm0, xmm1
        punpcklqdq      xmm0, xmm0
        movaps  XMMWORD PTR a[rip], xmm0
        movaps  XMMWORD PTR a[rip+16], xmm0
        ret
b:
        .zero   32
a:
        .zero   32


<a href="https://godbolt.org/z/nosYfb">https://godbolt.org/z/nosYfb</a></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>