Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 02f4bb5

Browse files
committed
[x86] add another partial undef vector binop test; NFC
The existing test unintentionally shows that we have prematurely optimized the shuffle into a vector concat and lost the undef info, so it is not affected by a basic improvement to SimplifyDemandedVectorElts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351834 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2432e36 commit 02f4bb5

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

test/CodeGen/X86/vector-partial-undef.ll

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,37 @@ define <4 x i64> @or_undef_elts(<2 x i64> %x) {
109109
define <8 x i32> @xor_undef_elts(<4 x i32> %x) {
110110
; SSE-LABEL: xor_undef_elts:
111111
; SSE: # %bb.0:
112+
; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,1,3]
113+
; SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[0,2,2,3]
114+
; SSE-NEXT: pxor {{.*}}(%rip), %xmm2
115+
; SSE-NEXT: pxor {{.*}}(%rip), %xmm1
116+
; SSE-NEXT: movdqa %xmm1, %xmm0
117+
; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,0],xmm2[2,0]
118+
; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm2[1,0]
119+
; SSE-NEXT: shufps {{.*#+}} xmm2 = xmm2[3,0],xmm1[0,0]
120+
; SSE-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,2],xmm2[2,0]
121+
; SSE-NEXT: retq
122+
;
123+
; AVX-LABEL: xor_undef_elts:
124+
; AVX: # %bb.0:
125+
; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,3,0,2]
126+
; AVX-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,3]
127+
; AVX-NEXT: vxorps {{.*}}(%rip), %ymm0, %ymm0
128+
; AVX-NEXT: vmovaps {{.*#+}} ymm1 = [6,1,5,4,3,2,0,7]
129+
; AVX-NEXT: vpermps %ymm0, %ymm1, %ymm0
130+
; AVX-NEXT: retq
131+
%extend = shufflevector <4 x i32> %x, <4 x i32> undef, <8 x i32> <i32 undef, i32 undef, i32 1, i32 3, i32 0, i32 2, i32 undef, i32 undef>
132+
%bogus_bo = xor <8 x i32> %extend, <i32 42, i32 43, i32 undef, i32 undef, i32 undef, i32 undef, i32 44, i32 12>
133+
%arbitrary_shuf = shufflevector <8 x i32> %bogus_bo, <8 x i32> undef, <8 x i32> <i32 6, i32 1, i32 5, i32 4, i32 3, i32 2, i32 0, i32 7>
134+
ret <8 x i32> %arbitrary_shuf
135+
}
136+
137+
; Verify that this isn't limited to high/low halves
138+
; Special case: the undef-ness of the 1st shuffle may be lost if we turn that into vector concat.
139+
140+
define <8 x i32> @xor_undef_elts_alt(<4 x i32> %x) {
141+
; SSE-LABEL: xor_undef_elts_alt:
142+
; SSE: # %bb.0:
112143
; SSE-NEXT: movaps %xmm0, %xmm1
113144
; SSE-NEXT: movaps {{.*#+}} xmm2 = <u,u,44,12>
114145
; SSE-NEXT: xorps %xmm0, %xmm2
@@ -120,7 +151,7 @@ define <8 x i32> @xor_undef_elts(<4 x i32> %x) {
120151
; SSE-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,2],xmm2[2,0]
121152
; SSE-NEXT: retq
122153
;
123-
; AVX-LABEL: xor_undef_elts:
154+
; AVX-LABEL: xor_undef_elts_alt:
124155
; AVX: # %bb.0:
125156
; AVX-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
126157
; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0

0 commit comments

Comments
 (0)