https://bugs.llvm.org/show_bug.cgi?id=42825
Bug ID: 42825
Summary: [X86][SSE] Failure to flip VPBLENDVB inputs with an
inverted selection mask
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Current Codegen: https://godbolt.org/z/hseT6Z
__m128i sel2(__m128i x, __m128i y, __m128i s) {
return _mm_blendv_epi8(x, y, _mm_xor_si128(s, _mm_set1_epi32(-1)));
}
clang -g0 -O3 -march=btver2
define <2 x i64> @_Z4sel2Dv2_xS_S_(<2 x i64>, <2 x i64>, <2 x i64>) {
%4 = bitcast <2 x i64> %0 to <16 x i8>
%5 = bitcast <2 x i64> %1 to <16 x i8>
%6 = bitcast <2 x i64> %2 to <16 x i8>
%7 = xor <16 x i8> %6, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8
-1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
%8 = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %4, <16 x i8> %5,
<16 x i8> %7) #2
%9 = bitcast <16 x i8> %8 to <2 x i64>
ret <2 x i64> %9
}
_Z4sel2Dv2_xS_S_:
vpcmpeqd %xmm3, %xmm3, %xmm3
vpxor %xmm3, %xmm2, %xmm2
vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
retq
we should be able to flip the inputs and remove the selection mask inversion:
_Z4sel2Dv2_xS_S_:
vpblendvb %xmm2, %xmm0, %xmm1, %xmm0
retq
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs