[llvm-bugs] [Bug 40083] New: [x86] psubus matching failure with undef elements
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 18 07:37:45 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40083
Bug ID: 40083
Summary: [x86] psubus matching failure with undef elements
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
This example came up in the discussion for D55780:
unsigned long long test_sub_2(__m128i x) {
__m128i c = _mm_set1_epi8(70);
return _mm_subs_epu8(x, c)[0];
}
Currently this becomes in IR:
define i64 @test_sub_2(<2 x i64> %x) {
%t0 = bitcast <2 x i64> %x to <16 x i8>
%cmp = icmp ugt <16 x i8> %t0, <i8 70, i8 70, i8 70, i8 70, i8 70, i8 70, i8
70, i8 70, i8 70, i8 70, i8 70, i8 70, i8 70, i8 70, i8 70, i8 70>
%bop = add <16 x i8> %0, <i8 -70, i8 -70, i8 -70, i8 -70, i8 -70, i8 -70, i8
-70, i8 -70, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8
undef, i8 undef>
%sel = select <16 x i1> %cmp, <16 x i8> %bop, <16 x i8> <i8 0, i8 0, i8 0, i8
0, i8 0, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8
undef, i8 undef, i8 undef>
%bc = bitcast <16 x i8> %sel to <2 x i64>
%ext = extractelement <2 x i64> %bc, i32 0
ret i64 %ext
}
And that becomes this in x86 asm:
vpmaxub LCPI0_0(%rip), %xmm0, %xmm1
vpcmpeqb %xmm1, %xmm0, %xmm1
vpaddb LCPI0_1(%rip), %xmm0, %xmm0
vpand %xmm0, %xmm1, %xmm0
vmovq %xmm0, %rax
---------------------------------------------------------------------------
We want this to become psubus again, but undefs are getting in the way.
It's possible that we also want to add an IR transform to turn the
bitcast+extract into an extracting shufflevector+bitcast.
--
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/20181218/f4202f42/attachment.html>
More information about the llvm-bugs
mailing list