[llvm-bugs] [Bug 32841] New: [X86][SSE] Use PHMINPOSUW for i8/i16 min/max reductions
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 28 05:25:15 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32841
Bug ID: 32841
Summary: [X86][SSE] Use PHMINPOSUW for i8/i16 min/max
reductions
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: filcab at gmail.com, llvm-bugs at lists.llvm.org,
spatel+llvm at rotateright.com
With suitable bit twiddling, PHMINPOSUW can be used to determine the
signed/unsigned min/max element of v16i8/v8i16 vectors, not just umin v8i16.
e.g.
unsigned char umin_v16i8(__m128i a) {
__m128i result = a;
result = _mm_min_epu8( result, _mm_srli_epi16( result, 8 ) );
result = _mm_minpos_epu16( result );
return _mm_extract_epi8(result, 0);
}
char smax_v16i8(__m128i a) {
__m128i k127 = _mm_set1_epi8(127);
__m128i result = a;
result = _mm_xor_si128( k127, result );
result = _mm_min_epu8( result, _mm_srli_epi16( result, 8 ) );
result = _mm_minpos_epu16( result );
result = _mm_xor_si128( k127, result );
return _mm_extract_epi8(result, 0);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170428/c7805c21/attachment.html>
More information about the llvm-bugs
mailing list