<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 - _mm_set_ps is lowered badly with sse4"
   href="https://bugs.llvm.org/show_bug.cgi?id=37502">37502</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_mm_set_ps is lowered badly with sse4
          </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>All
          </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>jmuizelaar@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>__m128 f(float aYScale, float aXScale) {
   return _mm_set_ps(aYScale, aXScale, aYScale, aXScale);
}

With -mssse3 this compiles to:

        unpcklps        %xmm0, %xmm1    # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1]
        movddup %xmm1, %xmm0            # xmm0 = xmm1[0,0]

with -mssse4 this compiles to:
        movaps  %xmm1, %xmm2
        insertps        $16, %xmm0, %xmm2 # xmm2 = xmm2[0],xmm0[0],xmm2[2,3]
        insertps        $32, %xmm1, %xmm2 # xmm2 = xmm2[0,1],xmm1[0],xmm2[3]
        insertps        $48, %xmm0, %xmm2 # xmm2 = xmm2[0,1,2],xmm0[0]
        movaps  %xmm2, %xmm0

llvm-mca -mcpu=haswell agrees that the ssse3 version is better:

Iterations:     1
Instructions:   2
Total Cycles:   5
Dispatch Width: 4
IPC:            0.40

vs

Iterations:     1
Instructions:   5
Total Cycles:   8
Dispatch Width: 4
IPC:            0.62</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>