<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 - SSE4.1 blend formation logic is not flexible"
href="https://bugs.llvm.org/show_bug.cgi?id=37549">37549</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SSE4.1 blend formation logic is not flexible
</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>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>lebedev.ri@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/g/iHXjfc">https://godbolt.org/g/iHXjfc</a>
#include <smmintrin.h>
void scalar(float* in, float thr, float* replace) {
if(in[0] >= thr || in[1] >= thr || in[2] >= thr || in[3] >= thr)
{
for(int c = 0; c < 4; c++)
{
in[c] = replace[c];
}
} else {
for(int c = 0; c < 4; c++)
{
in[c] = in[c];
}
}
}
__m128 notblend(__m128 in, __m128 thr, __m128 replace) {
__m128 isoe = _mm_cmpge_ps(in, thr);
isoe = _mm_or_ps(_mm_unpacklo_ps(isoe, isoe), _mm_unpackhi_ps(isoe, isoe));
isoe = _mm_or_ps(_mm_unpacklo_ps(isoe, isoe), _mm_unpackhi_ps(isoe, isoe));
__m128 result = _mm_or_ps(_mm_andnot_ps(isoe, in), _mm_and_ps(isoe,
replace));
return result;
}
__m128 almostblend(__m128 in, __m128 thr, __m128 replace) {
__m128 isoe = _mm_cmpge_ps(in, thr);
__m128 result = _mm_or_ps(_mm_andnot_ps(isoe, in), _mm_and_ps(isoe,
replace));
return result;
}
__m128 blend(__m128 in, __m128 thr, __m128 replace) {
__m128 isoe = _mm_cmpge_ps(in, thr);
__m128 result = _mm_blendv_ps(in, replace, isoe);
return result;
}
Last two are codegen'ed as vblendvps, the first two aren't.
The first one is likely a vectorizer failure.
The second example, notblend(), is of the most interest here.</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>