<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 - [SLP] Missed vectorization - division by a constant"
href="https://bugs.llvm.org/show_bug.cgi?id=47476">47476</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[SLP] Missed vectorization - division by a constant
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.bolvansky@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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</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>