Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / avx512-skx-insert-subvec.ll
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw -mattr=+avx512dq -mattr=+avx512vl| FileCheck %s
3
4 define <8 x i1> @test(<2 x i1> %a) {
5 ; CHECK-LABEL: test:
6 ; CHECK:       # BB#0:
7 ; CHECK-NEXT:    vpsllq $63, %xmm0, %xmm0
8 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
9 ; CHECK-NEXT:    kshiftlb $2, %k0, %k0
10 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
11 ; CHECK-NEXT:    retq
12   %res = shufflevector <2 x i1> %a, <2 x i1> undef, <8 x i32> <i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef>
13   ret <8 x i1> %res
14 }
15
16 define <8 x i1> @test1(<2 x i1> %a) {
17 ; CHECK-LABEL: test1:
18 ; CHECK:       # BB#0:
19 ; CHECK-NEXT:    vpsllq $63, %xmm0, %xmm0
20 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
21 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
22 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
23 ; CHECK-NEXT:    retq
24   %res = shufflevector <2 x i1> %a, <2 x i1> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef>
25   ret <8 x i1> %res
26 }
27
28 define <8 x i1> @test2(<2 x i1> %a) {
29 ; CHECK-LABEL: test2:
30 ; CHECK:       # BB#0:
31 ; CHECK-NEXT:    vpsllq $63, %xmm0, %xmm0
32 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
33 ; CHECK-NEXT:    vpmovm2q %k0, %zmm0
34 ; CHECK-NEXT:    vpxord %zmm1, %zmm1, %zmm1
35 ; CHECK-NEXT:    vshufi64x2 {{.*#+}} zmm0 = zmm1[0,1,0,1],zmm0[0,1,0,1]
36 ; CHECK-NEXT:    vpsllq $63, %zmm0, %zmm0
37 ; CHECK-NEXT:    vpmovq2m %zmm0, %k0
38 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
39 ; CHECK-NEXT:    retq
40   %res = shufflevector <2 x i1> %a, <2 x i1> zeroinitializer, <8 x i32> <i32 3, i32 3, i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef>
41   ret <8 x i1> %res
42 }
43
44 define <8 x i1> @test3(<4 x i1> %a) {
45 ; CHECK-LABEL: test3:
46 ; CHECK:       # BB#0:
47 ; CHECK-NEXT:    vpslld $31, %xmm0, %xmm0
48 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
49 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
50 ; CHECK-NEXT:    kshiftrb $4, %k0, %k0
51 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
52 ; CHECK-NEXT:    retq
53
54   %res = shufflevector <4 x i1> %a, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
55   ret <8 x i1> %res
56 }
57
58 define <8 x i1> @test4(<4 x i1> %a, <4 x i1>%b) {
59 ; CHECK-LABEL: test4:
60 ; CHECK:       # BB#0:
61 ; CHECK-NEXT:    vpslld $31, %xmm0, %xmm0
62 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
63 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
64 ; CHECK-NEXT:    kshiftrb $4, %k0, %k1
65 ; CHECK-NEXT:    korb %k0, %k1, %k0
66 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
67 ; CHECK-NEXT:    retq
68
69   %res = shufflevector <4 x i1> %a, <4 x i1> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
70   ret <8 x i1> %res
71 }
72
73 define <4 x i1> @test5(<2 x i1> %a, <2 x i1>%b) {
74 ; CHECK-LABEL: test5:
75 ; CHECK:       # BB#0:
76 ; CHECK-NEXT:    vpsllq $63, %xmm0, %xmm0
77 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
78 ; CHECK-NEXT:    kshiftlw $2, %k0, %k0
79 ; CHECK-NEXT:    kshiftrw $2, %k0, %k1
80 ; CHECK-NEXT:    korw %k0, %k1, %k0
81 ; CHECK-NEXT:    vpmovm2d %k0, %xmm0
82 ; CHECK-NEXT:    retq
83
84   %res = shufflevector <2 x i1> %a, <2 x i1> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
85   ret <4 x i1> %res
86 }
87
88 define <16 x i1> @test6(<2 x i1> %a, <2 x i1>%b) {
89 ; CHECK-LABEL: test6:
90 ; CHECK:       # BB#0:
91 ; CHECK-NEXT:    vpsllq $63, %xmm0, %xmm0
92 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
93 ; CHECK-NEXT:    kshiftlw $2, %k0, %k0
94 ; CHECK-NEXT:    kshiftrw $2, %k0, %k1
95 ; CHECK-NEXT:    korw %k0, %k1, %k0
96 ; CHECK-NEXT:    kunpckbw %k0, %k0, %k0
97 ; CHECK-NEXT:    vpmovm2b %k0, %xmm0
98 ; CHECK-NEXT:    retq
99
100   %res = shufflevector <2 x i1> %a, <2 x i1> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
101   ret <16 x i1> %res
102 }
103
104 define <32 x i1> @test7(<4 x i1> %a, <4 x i1>%b) {
105 ; CHECK-LABEL: test7:
106 ; CHECK:       # BB#0:
107 ; CHECK-NEXT:    vpslld $31, %xmm0, %xmm0
108 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
109 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
110 ; CHECK-NEXT:    kshiftrb $4, %k0, %k1
111 ; CHECK-NEXT:    korb %k0, %k1, %k0
112 ; CHECK-NEXT:    kunpckbw %k0, %k0, %k0
113 ; CHECK-NEXT:    kunpckwd %k0, %k0, %k0
114 ; CHECK-NEXT:    vpmovm2b %k0, %ymm0
115 ; CHECK-NEXT:    retq
116
117   %res = shufflevector <4 x i1> %a, <4 x i1> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
118   ret <32 x i1> %res
119 }
120
121 define <64 x i1> @test8(<8 x i1> %a, <8 x i1>%b) {
122 ; CHECK-LABEL: test8:
123 ; CHECK:       # BB#0:
124 ; CHECK-NEXT:    vpsllw $15, %xmm1, %xmm1
125 ; CHECK-NEXT:    vpmovw2m %xmm1, %k0
126 ; CHECK-NEXT:    vpsllw $15, %xmm0, %xmm0
127 ; CHECK-NEXT:    vpmovw2m %xmm0, %k1
128 ; CHECK-NEXT:    kunpckdq %k1, %k0, %k0
129 ; CHECK-NEXT:    vpmovm2b %k0, %zmm0
130 ; CHECK-NEXT:    retq
131
132   %res = shufflevector <8 x i1> %a, <8 x i1> %b, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
133   ret <64 x i1> %res
134 }
135