<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 - Suboptimal code for _mm256_zextsi128_si256(_mm_set1_epi8(-1))"
href="https://bugs.llvm.org/show_bug.cgi?id=45808">45808</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Suboptimal code for _mm256_zextsi128_si256(_mm_set1_epi8(-1))
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nemo@self-evident.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Related: <a class="bz_bug_link
bz_status_CONFIRMED "
title="CONFIRMED - Erroneous (?) error "invalid output size for constraint '=Yz'" (AVX2)"
href="show_bug.cgi?id=45806">Bug #45806</a> and <a href="https://stackoverflow.com/q/61601902/">https://stackoverflow.com/q/61601902/</a>
I am trying to produce an AVX2 mask with all-ones in the lower lane and
all-zeroes in the upper lane of a YMM register. The code I am using is:
__m256i mask = _mm256_zextsi128_si256(_mm_set1_epi8(-1));
This should produce a single instruction like `vpcmpeqd %xmm0,%xmm0,%xmm0`, but
Clang insists on putting the value into memory and loading it.
However, Clang insists on putting this into memory and loading it.
The behavior in context is even more odd:
__m256i minmax(__m256i v1, __m256i v2)
{
__m256i comp = _mm256_cmpgt_epi64(v1, v2);
__m256i mask = _mm256_zextsi128_si256(_mm_set1_epi8(-1));
return _mm256_blendv_epi8(v2, v1, _mm256_xor_si256(comp, mask));
}
This goes through a bunch of contortions with extracting, shifting, and
expanding 128-bit registers when I feel like the result I want is pretty
straightforward.
Godbolt example: <a href="https://gcc.godbolt.org/z/GPhJ6s">https://gcc.godbolt.org/z/GPhJ6s</a></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>