<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 - [SLPVectorizer] Investigate using poor throughput instructions as seed points"
href="https://bugs.llvm.org/show_bug.cgi?id=39432">39432</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[SLPVectorizer] Investigate using poor throughput instructions as seed points
</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>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>a.bataev@hotmail.com, andrea.dibiagio@gmail.com, dtemirbulatov@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Even for otherwise very different code paths, its often very beneficial to
vectorize poor throughput instructions (FDIV + FSQRT in particular) as they are
usually the bottleneck:
Codegen: <a href="https://godbolt.org/z/bWkftx">https://godbolt.org/z/bWkftx</a>
LLVM MCA Analysis: <a href="https://godbolt.org/z/eYmVHk">https://godbolt.org/z/eYmVHk</a>
void prim(double x, double y, double z, double w, double *p0, double *p1) {
x -= z;
y += w;
x /= z;
y /= w;
x -= z;
y += w;
*p0++ = x;
*p1++ = y;
}
Z4primddddPdS_: # @_Z4primddddPdS_
vsubsd %xmm2, %xmm0, %xmm0
vaddsd %xmm1, %xmm3, %xmm1
vdivsd %xmm2, %xmm0, %xmm0
vdivsd %xmm3, %xmm1, %xmm1
vsubsd %xmm2, %xmm0, %xmm0
vaddsd %xmm3, %xmm1, %xmm1
vmovsd %xmm0, (%rdi)
vmovsd %xmm1, (%rsi)
retq
block throughput: 38cy
void prim2(double x, double y, double z, double w, double *p0, double *p1) {
x -= z;
y += w;
__m128d xy = _mm_div_pd(_mm_setr_pd(x, y), _mm_setr_pd(z, w));
x = xy[0];
y = xy[1];
x -= z;
y += w;
*p0++ = x;
*p1++ = y;
}
_Z5prim2ddddPdS_: # @_Z5prim2ddddPdS_
vsubsd %xmm2, %xmm0, %xmm0
vaddsd %xmm1, %xmm3, %xmm1
vunpcklpd %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0]
vunpcklpd %xmm3, %xmm2, %xmm1 # xmm1 = xmm2[0],xmm3[0]
vdivpd %xmm1, %xmm0, %xmm0
vpermilpd $1, %xmm0, %xmm1 # xmm1 = xmm0[1,0]
vsubsd %xmm2, %xmm0, %xmm0
vaddsd %xmm3, %xmm1, %xmm1
vmovsd %xmm0, (%rdi)
vmovsd %xmm1, (%rsi)
retq
block throughput: 19cy</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>