<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 - _mm256_shuffle_ps(_,_,0x44) compiles to vunpcklpd with -march= icelake-client"
   href="https://bugs.llvm.org/show_bug.cgi?id=44113">44113</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_mm256_shuffle_ps(_,_,0x44) compiles to vunpcklpd with -march= icelake-client
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>DrTroll@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In a recent Stackoverflow discussion (link:
<a href="https://stackoverflow.com/questions/58954801/avx-equivalent-for-mm-movelh-ps">https://stackoverflow.com/questions/58954801/avx-equivalent-for-mm-movelh-ps</a>)
we found out that the instruction _mm256_shuffle_ps(_,_,0x44) is compiled to
vunpcklpd by Clang. This is a possible optimization for Skylake and other
processors which have identical throughput for shuffles and unpacks.
But as the Stackoverflow-user Peter Cordes mentioned in his answer, Ice Lake
processors have a higher throughput for shuffles than for unpacks:

unpack: 
<a href="https://www.uops.info/table.html?search=vunpcklp&cb_lat=on&cb_tp=on&cb_uops=on&cb_ports=on&cb_SKL=on&cb_ICL=on&cb_measurements=on&cb_iaca30=on&cb_doc=on&cb_avx=on&cb_avx2=on">https://www.uops.info/table.html?search=vunpcklp&cb_lat=on&cb_tp=on&cb_uops=on&cb_ports=on&cb_SKL=on&cb_ICL=on&cb_measurements=on&cb_iaca30=on&cb_doc=on&cb_avx=on&cb_avx2=on</a>

shuffle:
<a href="https://www.uops.info/table.html?search=vshufp&cb_lat=on&cb_tp=on&cb_uops=on&cb_ports=on&cb_SKL=on&cb_ICL=on&cb_measurements=on&cb_iaca30=on&cb_doc=on&cb_avx=on&cb_avx2=on">https://www.uops.info/table.html?search=vshufp&cb_lat=on&cb_tp=on&cb_uops=on&cb_ports=on&cb_SKL=on&cb_ICL=on&cb_measurements=on&cb_iaca30=on&cb_doc=on&cb_avx=on&cb_avx2=on</a>

Therefore, the performed replacement of the shuffle is contra-productive on an
Ice Lake processor.
Even with -march= icelake-client, Clang replaces the shuffle with vunpcklpd:

<a href="https://godbolt.org/z/MqtJXY">https://godbolt.org/z/MqtJXY</a>


Same goes for _mm256_shuffle_ps(_,_,0xee) vunpckhpd.</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>