Skip to content

Commit 78cd95c

Browse files
committed
[X86] Add test case for interleave shuffle for sub/add
1 parent c82fb16 commit 78cd95c

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512vl,+avx512bw %s -o - | FileCheck %s
3+
4+
define <16 x i32> @shuffle_v8i64(<16 x i32> %t0, <16 x i32> %t1) {
5+
; CHECK-LABEL: shuffle_v8i64:
6+
; CHECK: # %bb.0: # %entry
7+
; CHECK-NEXT: vpaddd %zmm1, %zmm0, %zmm2
8+
; CHECK-NEXT: vpsubd %zmm1, %zmm0, %zmm0
9+
; CHECK-NEXT: movb $-86, %al
10+
; CHECK-NEXT: kmovd %eax, %k1
11+
; CHECK-NEXT: vmovdqa64 %zmm0, %zmm2 {%k1}
12+
; CHECK-NEXT: vmovdqa64 %zmm2, %zmm0
13+
; CHECK-NEXT: retq
14+
entry:
15+
%t2 = add nsw <16 x i32> %t0, %t1
16+
%t3 = sub nsw <16 x i32> %t0, %t1
17+
%t4 = shufflevector <16 x i32> %t2, <16 x i32> %t3, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 4, i32 5, i32 22, i32 23, i32 8, i32 9, i32 26, i32 27, i32 12, i32 13, i32 30, i32 31>
18+
ret <16 x i32> %t4
19+
}
20+
21+
define <8 x i32> @shuffle_v4i64(<8 x i32> %t0, <8 x i32> %t1) {
22+
; CHECK-LABEL: shuffle_v4i64:
23+
; CHECK: # %bb.0: # %entry
24+
; CHECK-NEXT: vpaddd %ymm1, %ymm0, %ymm2
25+
; CHECK-NEXT: vpsubd %ymm1, %ymm0, %ymm0
26+
; CHECK-NEXT: vpblendd {{.*#+}} ymm0 = ymm2[0,1],ymm0[2,3],ymm2[4,5],ymm0[6,7]
27+
; CHECK-NEXT: retq
28+
entry:
29+
%t2 = add nsw <8 x i32> %t0, %t1
30+
%t3 = sub nsw <8 x i32> %t0, %t1
31+
%t4 = shufflevector <8 x i32> %t2, <8 x i32> %t3, <8 x i32> <i32 0, i32 1, i32 10, i32 11, i32 4, i32 5, i32 14, i32 15>
32+
ret <8 x i32> %t4
33+
}
34+
35+
define <4 x i32> @shuffle_v2i64(<4 x i32> %t0, <4 x i32> %t1) {
36+
; CHECK-LABEL: shuffle_v2i64:
37+
; CHECK: # %bb.0: # %entry
38+
; CHECK-NEXT: vpaddd %xmm1, %xmm0, %xmm2
39+
; CHECK-NEXT: vpsubd %xmm1, %xmm0, %xmm0
40+
; CHECK-NEXT: vpblendd {{.*#+}} xmm0 = xmm2[0,1],xmm0[2,3]
41+
; CHECK-NEXT: retq
42+
entry:
43+
%t2 = add nsw <4 x i32> %t0, %t1
44+
%t3 = sub nsw <4 x i32> %t0, %t1
45+
%t4 = shufflevector <4 x i32> %t2, <4 x i32> %t3, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
46+
ret <4 x i32> %t4
47+
}
48+
49+
define <2 x i32> @shuffle_v2i32(<2 x i32> %t0, <2 x i32> %t1) {
50+
; CHECK-LABEL: shuffle_v2i32:
51+
; CHECK: # %bb.0: # %entry
52+
; CHECK-NEXT: vpaddd %xmm1, %xmm0, %xmm2
53+
; CHECK-NEXT: vpsubd %xmm1, %xmm0, %xmm0
54+
; CHECK-NEXT: vpblendd {{.*#+}} xmm0 = xmm2[0],xmm0[1],xmm2[2,3]
55+
; CHECK-NEXT: retq
56+
entry:
57+
%t2 = add nsw <2 x i32> %t0, %t1
58+
%t3 = sub nsw <2 x i32> %t0, %t1
59+
%t4 = shufflevector <2 x i32> %t2, <2 x i32> %t3, <2 x i32> <i32 0, i32 3>
60+
ret <2 x i32> %t4
61+
}

0 commit comments

Comments
 (0)