Skip to content

Commit 31992a6

Browse files
committed
[x86] add test for concat-extract corner case; NFC
See D72361 for discussion.
1 parent 43f938e commit 31992a6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/test/CodeGen/X86/extract-concat.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,25 @@ define <16 x i64> @load_catcat(<4 x i64>* %p) {
147147
%r = shufflevector <16 x i64> %cat2, <16 x i64> undef, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15>
148148
ret <16 x i64> %r
149149
}
150+
151+
; Use weird types to make sure we do not miscompile a case where
152+
; the source ops are not an even multiple size of the result.
153+
154+
define <4 x i32> @cat_ext_straddle(<6 x i32>* %px, <6 x i32>* %py) {
155+
; SSE42-LABEL: cat_ext_straddle:
156+
; SSE42: # %bb.0:
157+
; SSE42-NEXT: movaps 16(%rdi), %xmm0
158+
; SSE42-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],mem[0]
159+
; SSE42-NEXT: retq
160+
;
161+
; AVX-LABEL: cat_ext_straddle:
162+
; AVX: # %bb.0:
163+
; AVX-NEXT: vmovaps 16(%rdi), %xmm0
164+
; AVX-NEXT: vunpcklpd {{.*#+}} xmm0 = xmm0[0],mem[0]
165+
; AVX-NEXT: retq
166+
%x = load <6 x i32>, <6 x i32>* %px
167+
%y = load <6 x i32>, <6 x i32>* %py
168+
%cat = shufflevector <6 x i32> %x, <6 x i32> %y, <12 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
169+
%ext = shufflevector <12 x i32> %cat, <12 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
170+
ret <4 x i32> %ext
171+
}

0 commit comments

Comments
 (0)