[llvm-bugs] [Bug 44113] New: _mm256_shuffle_ps(_, _, 0x44) compiles to vunpcklpd with -march= icelake-client
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 22 04:38:43 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44113
Bug ID: 44113
Summary: _mm256_shuffle_ps(_,_,0x44) compiles to vunpcklpd with
-march= icelake-client
Product: clang
Version: 9.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: DrTroll at gmx.de
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
In a recent Stackoverflow discussion (link:
https://stackoverflow.com/questions/58954801/avx-equivalent-for-mm-movelh-ps)
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:
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
shuffle:
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
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:
https://godbolt.org/z/MqtJXY
Same goes for _mm256_shuffle_ps(_,_,0xee) vunpckhpd.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191122/170c6e3c/attachment.html>
More information about the llvm-bugs
mailing list