<html>
<head>
<base href="https://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 --- - Instcombine(?) should factor broadcasts across math"
href="https://llvm.org/bugs/show_bug.cgi?id=31286">31286</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Instcombine(?) should factor broadcasts across math
</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>normal
</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>mkuper@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Not actually sure "factor" is the right term here, what I mean is that we're
missing:
bcast(x) + bcast(y) -> bcast(x + y)
Right now, for:
#include <immintrin.h>
__m128 bar(float f, float g, float h, float i) {
__m128 v0 = _mm_set_ps1(f);
__m128 v1 = _mm_set_ps1(g);
__m128 v2 = _mm_set_ps1(h);
__m128 v3 = _mm_set_ps1(i);
return v0 + v1 + v2 + v3;
}
We get:
bar(float, float, float, float): # @bar(float,
float, float, float)
shufps $0, %xmm0, %xmm0 # xmm0 = xmm0[0,0,0,0]
shufps $0, %xmm1, %xmm1 # xmm1 = xmm1[0,0,0,0]
shufps $0, %xmm2, %xmm2 # xmm2 = xmm2[0,0,0,0]
shufps $0, %xmm3, %xmm3 # xmm3 = xmm3[0,0,0,0]
addps %xmm1, %xmm0
addps %xmm2, %xmm0
addps %xmm3, %xmm0
retq
Instead of:
bar(float, float, float, float):
addss %xmm1, %xmm0
addss %xmm2, %xmm0
addss %xmm3, %xmm0
shufps $0, %xmm0, %xmm0
ret
There's another odd thing here - in IR we represent each broadcast as a
sequence of insertelements, instead of an insert + shuffle, which, I believe,
is the canonical form (at least, this is what the vectorizer produces)
That should probably be fixed first, so we have only one canonical broadcast to
match.</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>