[llvm-bugs] [Bug 39161] New: Missed optimisation in shuffle operation on avx
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 3 06:44:59 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39161
Bug ID: 39161
Summary: Missed optimisation in shuffle operation on avx
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: hello at dsprenkels.com
CC: llvm-bugs at lists.llvm.org
I have the following C snippet:
```
__m256d example(__m256d x)
{
__m256d ret = {};
ret[0] = x[2];
ret[1] = x[2];
ret[2] = x[3];
ret[3] = x[3];
return ret;
}
```
which can be implemented using:
```
example:
vperm2f128 ymm0, ymm0, ymm0, 0b00010001 ; [aa, bb, aa, bb]
vpermilpd ymm0, ymm0, 0b1100 ; [aa, aa, bb, bb]
ret
```
But LLVM compiles the code to:
```
example: # @example
vextractf128 xmm0, ymm0, 1
vmovddup xmm1, xmm0 # xmm1 = xmm0[0,0]
vpermilpd xmm0, xmm0, 3 # xmm0 = xmm0[1,1]
vinsertf128 ymm0, ymm1, xmm0, 1
ret
```
Here's a link to the same snippet in godbolt: https://godbolt.org/z/NPYv_z
I would like to take a shot at fixing this myself, if this is not too hard to
implement. At least, if it's possible and desired by you guys.
At the moment of compilation, godbolt reported the following version
information:
```
clang version 8.0.0 (trunk 343649)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-trunk/bin
Compiler returned: 0
```
--
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/20181003/0c2043a9/attachment-0001.html>
More information about the llvm-bugs
mailing list