<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 - Bad optimization of reverse-initialization of 128-bit vector with 64-bit vectors"
   href="https://bugs.llvm.org/show_bug.cgi?id=45748">45748</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bad optimization of reverse-initialization of 128-bit vector with 64-bit vectors
          </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>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>gabravier@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 int32_t v2si __attribute__((vector_size(8)));
typedef int64_t v2di __attribute__((vector_size(16)));

v2di setr_epi64(v2si q0, v2si q1)
{
    return v2di{(int64_t)q0, (int64_t)q1};
}

GCC -O3 produces :

setr_epi64(int __vector(2), int __vector(2)):
  punpcklqdq xmm0, xmm1
  ret

LLVM produces :

setr_epi64(int __vector(2), int __vector(2)): # @setr_epi64(int __vector(2),
int __vector(2))
  movq rax, xmm0
  movq rcx, xmm1
  movq xmm1, rcx
  movq xmm0, rax
  punpcklqdq xmm0, xmm1 # xmm0 = xmm0[0],xmm1[0]
  ret

The code here cannot be further minimized, from what I've been able to see with
my tests.

See also <a href="https://godbolt.org/z/ZC-SWs">https://godbolt.org/z/ZC-SWs</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>