[llvm-bugs] [Bug 47476] New: [SLP] Missed vectorization - division by a constant
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 9 12:52:10 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47476
Bug ID: 47476
Summary: [SLP] Missed vectorization - division by a constant
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
int a[4], b[4];
void foo()
{
a[0] = b[0] / 5;
a[1] = b[1] / 5;
a[2] = b[2] / 5;
a[3] = b[3] / 5;
}
Flags: -O3 -mavx2
Clang:
foo(): # @foo()
movsxd rax, dword ptr [rip + b]
imul rax, rax, 1717986919
mov rcx, rax
shr rcx, 63
sar rax, 33
add eax, ecx
mov dword ptr [rip + a], eax
movsxd rax, dword ptr [rip + b+4]
imul rax, rax, 1717986919
mov rcx, rax
shr rcx, 63
sar rax, 33
add eax, ecx
mov dword ptr [rip + a+4], eax
movsxd rax, dword ptr [rip + b+8]
imul rax, rax, 1717986919
mov rcx, rax
shr rcx, 63
sar rax, 33
add eax, ecx
mov dword ptr [rip + a+8], eax
movsxd rax, dword ptr [rip + b+12]
imul rax, rax, 1717986919
mov rcx, rax
shr rcx, 63
sar rax, 33
add eax, ecx
mov dword ptr [rip + a+12], eax
ret
a:
.zero 16
b:
.zero 16
GCC / ICC:
foo():
vmovdqu xmm7, XMMWORD PTR b[rip] #4.10
vmovupd xmm1, XMMWORD PTR .L_2il0floatpacket.1[rip] #4.3
vpsrad xmm9, xmm7, 31 #4.3
vpshufd xmm0, xmm7, 49 #4.3
vpmuldq xmm2, xmm7, xmm1 #4.3
vpmuldq xmm3, xmm0, xmm1 #4.3
vpsrlq xmm4, xmm2, 32 #4.3
vpand xmm5, xmm3, XMMWORD PTR .L_2il0floatpacket.2[rip] #4.3
vpor xmm6, xmm4, xmm5 #4.3
vpsrad xmm8, xmm6, 1 #4.3
vpsubd xmm10, xmm8, xmm9 #4.3
vmovdqu XMMWORD PTR a[rip], xmm10 #4.3
ret
--
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/20200909/48e38c45/attachment-0001.html>
More information about the llvm-bugs
mailing list