<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 - [IR] Suboptimal vector code"
href="https://bugs.llvm.org/show_bug.cgi?id=47494">47494</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[IR] Suboptimal vector code
</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>Windows NT
</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>void test(int* restrict r, int* restrict a){
for (int i = 0; i < 16; i++){
r[i] += r[i+1];
}
}
Clang -O3 -mavx2:
test: # @test
vmovdqu ymm0, ymmword ptr [rdi]
vmovdqu ymm1, ymmword ptr [rdi + 32]
vperm2i128 ymm2, ymm0, ymm1, 33 # ymm2 = ymm0[2,3],ymm1[0,1]
vpalignr ymm2, ymm2, ymm0, 4 # ymm2 =
ymm0[4,5,6,7,8,9,10,11,12,13,14,15],ymm2[0,1,2,3],ymm0[20,21,22,23,24,25,26,27,28,29,30,31],ymm2[16,17,18,19]
vpaddd ymm0, ymm0, ymm2
vmovdqu ymmword ptr [rdi], ymm0
vmovdqu xmm0, xmmword ptr [rdi + 48]
vpshufd xmm2, xmm0, 249 # xmm2 = xmm0[1,2,3,3]
vpinsrd xmm2, xmm2, dword ptr [rdi + 64], 3
vpalignr xmm0, xmm0, xmmword ptr [rdi + 32], 4 # xmm0 =
mem[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
vinserti128 ymm0, ymm0, xmm2, 1
vpaddd ymm0, ymm1, ymm0
vmovdqu ymmword ptr [rdi + 32], ymm0
vzeroupper
ret
ICC -O3 -mavx2:
test:
vmovdqu ymm0, YMMWORD PTR [rdi] #4.10
vmovdqu ymm2, YMMWORD PTR [32+rdi] #4.10
vpaddd ymm1, ymm0, YMMWORD PTR [4+rdi] #4.10
vpaddd ymm3, ymm2, YMMWORD PTR [36+rdi] #4.10
vmovdqu YMMWORD PTR [rdi], ymm1 #4.10
vmovdqu YMMWORD PTR [32+rdi], ymm3 #4.10
vzeroupper #6.1
ret #6.1</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>