<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] Recognise v2i64 comparison patterns"
href="https://bugs.llvm.org/show_bug.cgi?id=33614">33614</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86][SSE] Recognise v2i64 comparison patterns
</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>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Before SSE41/SSE42, the only way to compare eq/gt v2i64 vectors was to use the
v4i32 intrinsics:
__m128i alt_cmpeq_epi64(__m128i a, __m128i b) {
__m128i c = _mm_cmpeq_epi32(a, b);
return _mm_and_si128( c, _mm_shuffle_epi32( c, _MM_SHUFFLE(2,3,0,1) ) );
}
__m128i alt_cmpgt_epi64(__m128i a, __m128i b) {
__m128i flip = _mm_setr_epi32( 0x80000000,0x00000000,0x80000000,0x00000000 );
a = _mm_xor_si128( a, flip );
b = _mm_xor_si128( b, flip );
__m128i gt = _mm_cmpgt_epi32( a, b );
__m128i gt0 = _mm_shuffle_epi32( gt, _MM_SHUFFLE(2,2,0,0) );
__m128i gt1 = _mm_shuffle_epi32( gt, _MM_SHUFFLE(3,3,1,1) );
__m128i eq = _mm_cmpeq_epi32( a, b );
__m128i eq0 = _mm_shuffle_epi32( eq, _MM_SHUFFLE(3,3,1,1) );
return _mm_or_si128( _mm_and_si128( gt0, eq0 ), gt1 );
}
__m128i alt_cmpgt_epu64(__m128i a, __m128i b) {
__m128i flip = _mm_set1_epi32( 0x80000000 );
a = _mm_xor_si128( a, flip );
b = _mm_xor_si128( b, flip );
__m128i gt = _mm_cmpgt_epi32( a, b );
__m128i gt0 = _mm_shuffle_epi32( gt, _MM_SHUFFLE(2,2,0,0) );
__m128i gt1 = _mm_shuffle_epi32( gt, _MM_SHUFFLE(3,3,1,1) );
__m128i eq = _mm_cmpeq_epi32( a, b );
__m128i eq0 = _mm_shuffle_epi32( eq, _MM_SHUFFLE(3,3,1,1) );
return _mm_or_si128( _mm_and_si128( gt0, eq0 ), gt1 );
}
Resulting in quite a bit of legacy code that still uses this (I've only seen
this in __m128i code). We should be trying to simplify this where possible.</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>