<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 - Missed vectorization (trunk vs 10)"
href="https://bugs.llvm.org/show_bug.cgi?id=47450">47450</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missed vectorization (trunk vs 10)
</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>Scalar Optimizations
</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>unsigned int output[8];
void test4 (unsigned short *p)
{
unsigned int x = *p;
if (x)
{
output[0] = x << 1;
output[1] = x << 1;
output[2] = x << 1;
output[3] = x << 1;
}
}
Clang trunk -O3:
test4(unsigned short*): # @test4(unsigned short*)
movzx eax, word ptr [rdi]
test eax, eax
je .LBB0_2
add eax, eax
mov dword ptr [rip + output], eax
mov dword ptr [rip + output+4], eax
mov dword ptr [rip + output+8], eax
mov dword ptr [rip + output+12], eax
.LBB0_2:
ret
output:
.zero 32
Clang 10.1 -O3:
test4(unsigned short*): # @test4(unsigned short*)
movzx eax, word ptr [rdi]
test eax, eax
je .LBB0_2
movd xmm0, eax
pshufd xmm0, xmm0, 0 # xmm0 = xmm0[0,0,0,0]
pslld xmm0, 1
movdqa xmmword ptr [rip + output], xmm0
.LBB0_2:
ret
output:
.zero 32
ICC/GCC -O3:
test4(unsigned short*):
movzx eax, WORD PTR [rdi] #5.21
test eax, eax #6.7
je ..B1.3 # Prob 50% #6.7
add eax, eax #8.24
movd xmm0, eax #8.24
pshufd xmm1, xmm0, 0 #8.24
movdqu XMMWORD PTR output[rip], xmm1 #8.7
..B1.3: # Preds ..B1.1 ..B1.2
ret #13.1
output:
.zero 32
It would be good to match icc's codegen.
<a href="https://godbolt.org/z/n9a59P">https://godbolt.org/z/n9a59P</a></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>