<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 - Suboptimal codegen for vector init constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=47642">47642</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Suboptimal codegen for vector init constructor
          </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>Backend: X86
          </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>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>typedef int __v4si __attribute__ ((__vector_size__ (16)));

__v4si
foo (__v4si x, int f)
{
  __v4si y = { f, f + 1 , f + 2, f + 3};
  return y;
}

Clang -O3:
foo(int __vector(4), int):                           # @foo(int __vector(4),
int)
        lea     eax, [rdi + 1]
        lea     ecx, [rdi + 2]
        lea     edx, [rdi + 3]
        movd    xmm0, edx
        movd    xmm1, ecx
        punpckldq       xmm1, xmm0              # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1]
        movd    xmm0, edi
        movd    xmm2, eax
        punpckldq       xmm0, xmm2              # xmm0 =
xmm0[0],xmm2[0],xmm0[1],xmm2[1]
        punpcklqdq      xmm0, xmm1              # xmm0 = xmm0[0],xmm1[0]
        ret


GCC -O3:
foo(int __vector(4), int):
        movd    xmm1, edi
        pshufd  xmm0, xmm1, 0
        paddd   xmm0, XMMWORD PTR .LC0[rip]
        ret
.LC0:
        .long   0
        .long   1
        .long   2
        .long   3



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