<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 vectorizer cost model should handle divide by power-of-two constants"
href="http://llvm.org/bugs/show_bug.cgi?id=20714">20714</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SLP vectorizer cost model should handle divide by power-of-two constants
</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>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>grosbach@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Inspired by the equivalent X86 problem being handled in
<a href="http://reviews.llvm.org/D4971">http://reviews.llvm.org/D4971</a>
Consider:
void f(int *restrict a, int *restrict b, int *restrict c) {
a[0] = (b[0] + c[0]) / 2;
a[1] = (b[1] + c[1]) / 2;
a[2] = (b[2] + c[2]) / 2;
a[3] = (b[3] + c[3]) / 2;
}
ARM64 can handle this via:
ldr q0, [x0]
ldr q1, [x1]
add.4s v0, v0, v1
usra.4s v0, v0, #31
sshr.4s v0, v0, #1
str q0, [x2]
Instead we generate the long scalarized sequence:
ldp w8, w9, [x1]
ldp w10, w11, [x2]
add w8, w10, w8
cmp w8, #0 ; =0
cinc w8, w8, lt
asr w8, w8, #1
str w8, [x0]
add w8, w11, w9
cmp w8, #0 ; =0
cinc w8, w8, lt
asr w8, w8, #1
str w8, [x0, #4]
ldp w8, w9, [x1, #8]
ldp w10, w11, [x2, #8]
add w8, w10, w8
cmp w8, #0 ; =0
cinc w8, w8, lt
asr w8, w8, #1
str w8, [x0, #8]
add w8, w11, w9
cmp w8, #0 ; =0
cinc w8, w8, lt
asr w8, w8, #1
str w8, [x0, #12]</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>