<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 - [X86][SSE] Access a scalar float/double as a free extract from a broadcast load"
href="https://bugs.llvm.org/show_bug.cgi?id=43217">43217</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86][SSE] Access a scalar float/double as a free extract from a broadcast load
</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>Backend: X86
</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>andrea.dibiagio@gmail.com, craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Current Codegen: <a href="https://godbolt.org/z/nm4NKg">https://godbolt.org/z/nm4NKg</a>
#include <x86intrin.h>
__m256 broadcast_scl(float *src, float *dst) {
float f = *src;
*dst = f;
return _mm256_set1_ps(f);
}
__m256 broadcast_vec(float *src, float *dst) {
__m256 v = _mm256_set1_ps(*src);
*dst = _mm256_cvtss_f32(v);
return v;
}
Both these result in a scalar load, scalar store and a broadcast (on AVX1 split
across 2 instruction):
vmovss (%rdi), %xmm1 # xmm1 = mem[0],zero,zero,zero
vpermilps $0, %xmm1, %xmm0 # xmm0 = xmm1[0,0,0,0]
vmovss %xmm1, (%rsi)
vinsertf128 $1, %xmm0, %ymm0, %ymm0
retq
But we could do this more efficiently as:
vbroadcastss (%rdi), %ymm0
vmovss %xmm0, (%rsi)
retq
We could probably achieve this in DAG by just replacing other uses of the
loaded scalar as a (free) extract of the broadcast.</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>