[llvm-bugs] [Bug 36933] New: shufflevector produces sub-optimal code on AVX2
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 28 05:03:08 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=36933
Bug ID: 36933
Summary: shufflevector produces sub-optimal code on AVX2
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: gonzalobg88 at gmail.com
CC: llvm-bugs at lists.llvm.org
The following operation does a shift %left one byte to the right, while
shifting the rightmost byte of %right into the leftmost byte of %left:
define void @foo(<32 x i8>*, <32 x i8>* %left, <32 x i8>* %right) unnamed_addr
#0 {
%2 = load <32 x i8>, <32 x i8>* %left, align 32
%3 = load <32 x i8>, <32 x i8>* %right, align 32
%4 = shufflevector <32 x i8> %2, <32 x i8> %3,
<32 x i32>
<i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38,
i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46,
i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54,
i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62>
store <32 x i8> %4, <32 x i8>* %0, align 32
ret void
}
but LLVM produces the following sub-optimal assembly:
.LCPI0_0:
.byte 255 # 0xff
...
.byte 255 # 0xff
.byte 0 # 0x0
foo: # @foo
vmovdqa ymm0, ymmword ptr [rsi]
vmovdqa ymm1, ymmword ptr [rip + .LCPI0_0]
vpblendvb ymm0, ymm0, ymmword ptr [rdx], ymm1
vpermq ymm1, ymm0, 78
vpalignr ymm0, ymm0, ymm1, 15
vmovdqa ymmword ptr [rdi], ymm0
vzeroupper
ret
where instead of doing a vmovdqa (to load a constant), vpblendvb, vperm2i128
and vpalignr it should just do a vperm2i128 followed by vpalignr.
--
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/20180328/5a8b0721/attachment-0001.html>
More information about the llvm-bugs
mailing list