1612ea40d5c57fc329bb03051984f19ee7befab6
[oota-llvm.git] / test / CodeGen / X86 / avx512dqvl-intrinsics.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl -mattr=+avx512dq -mattr=+avx512vl --show-mc-encoding| FileCheck %s
2
3 define <8 x i64> @test_mask_mullo_epi64_rr_512(<8 x i64> %a, <8 x i64> %b) {
4   ;CHECK-LABEL: test_mask_mullo_epi64_rr_512
5   ;CHECK: vpmullq %zmm1, %zmm0, %zmm0     ## encoding: [0x62,0xf2,0xfd,0x48,0x40,0xc1]
6   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 -1)
7   ret <8 x i64> %res
8 }
9
10 define <8 x i64> @test_mask_mullo_epi64_rrk_512(<8 x i64> %a, <8 x i64> %b, <8 x i64> %passThru, i8 %mask) {
11   ;CHECK-LABEL: test_mask_mullo_epi64_rrk_512
12   ;CHECK: vpmullq %zmm1, %zmm0, %zmm2 {%k1} ## encoding: [0x62,0xf2,0xfd,0x49,0x40,0xd1]
13   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> %passThru, i8 %mask)
14   ret <8 x i64> %res
15 }
16
17 define <8 x i64> @test_mask_mullo_epi64_rrkz_512(<8 x i64> %a, <8 x i64> %b, i8 %mask) {
18   ;CHECK-LABEL: test_mask_mullo_epi64_rrkz_512
19   ;CHECK: vpmullq %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xc9,0x40,0xc1]
20   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 %mask)
21   ret <8 x i64> %res
22 }
23
24 define <8 x i64> @test_mask_mullo_epi64_rm_512(<8 x i64> %a, <8 x i64>* %ptr_b) {
25   ;CHECK-LABEL: test_mask_mullo_epi64_rm_512
26   ;CHECK: vpmullq (%rdi), %zmm0, %zmm0    ## encoding: [0x62,0xf2,0xfd,0x48,0x40,0x07]
27   %b = load <8 x i64>, <8 x i64>* %ptr_b
28   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 -1)
29   ret <8 x i64> %res
30 }
31
32 define <8 x i64> @test_mask_mullo_epi64_rmk_512(<8 x i64> %a, <8 x i64>* %ptr_b, <8 x i64> %passThru, i8 %mask) {
33   ;CHECK-LABEL: test_mask_mullo_epi64_rmk_512
34   ;CHECK: vpmullq (%rdi), %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x49,0x40,0x0f]
35   %b = load <8 x i64>, <8 x i64>* %ptr_b
36   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> %passThru, i8 %mask)
37   ret <8 x i64> %res
38 }
39
40 define <8 x i64> @test_mask_mullo_epi64_rmkz_512(<8 x i64> %a, <8 x i64>* %ptr_b, i8 %mask) {
41   ;CHECK-LABEL: test_mask_mullo_epi64_rmkz_512
42   ;CHECK: vpmullq (%rdi), %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xc9,0x40,0x07]
43   %b = load <8 x i64>, <8 x i64>* %ptr_b
44   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 %mask)
45   ret <8 x i64> %res
46 }
47
48 define <8 x i64> @test_mask_mullo_epi64_rmb_512(<8 x i64> %a, i64* %ptr_b) {
49   ;CHECK-LABEL: test_mask_mullo_epi64_rmb_512
50   ;CHECK: vpmullq (%rdi){1to8}, %zmm0, %zmm0  ## encoding: [0x62,0xf2,0xfd,0x58,0x40,0x07]
51   %q = load i64, i64* %ptr_b
52   %vecinit.i = insertelement <8 x i64> undef, i64 %q, i32 0
53   %b = shufflevector <8 x i64> %vecinit.i, <8 x i64> undef, <8 x i32> zeroinitializer
54   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 -1)
55   ret <8 x i64> %res
56 }
57
58 define <8 x i64> @test_mask_mullo_epi64_rmbk_512(<8 x i64> %a, i64* %ptr_b, <8 x i64> %passThru, i8 %mask) {
59   ;CHECK-LABEL: test_mask_mullo_epi64_rmbk_512
60   ;CHECK: vpmullq (%rdi){1to8}, %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x59,0x40,0x0f]
61   %q = load i64, i64* %ptr_b
62   %vecinit.i = insertelement <8 x i64> undef, i64 %q, i32 0
63   %b = shufflevector <8 x i64> %vecinit.i, <8 x i64> undef, <8 x i32> zeroinitializer
64   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> %passThru, i8 %mask)
65   ret <8 x i64> %res
66 }
67
68 define <8 x i64> @test_mask_mullo_epi64_rmbkz_512(<8 x i64> %a, i64* %ptr_b, i8 %mask) {
69   ;CHECK-LABEL: test_mask_mullo_epi64_rmbkz_512
70   ;CHECK: vpmullq (%rdi){1to8}, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xd9,0x40,0x07]
71   %q = load i64, i64* %ptr_b
72   %vecinit.i = insertelement <8 x i64> undef, i64 %q, i32 0
73   %b = shufflevector <8 x i64> %vecinit.i, <8 x i64> undef, <8 x i32> zeroinitializer
74   %res = call <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64> %a, <8 x i64> %b, <8 x i64> zeroinitializer, i8 %mask)
75   ret <8 x i64> %res
76 }
77 declare <8 x i64> @llvm.x86.avx512.mask.pmull.q.512(<8 x i64>, <8 x i64>, <8 x i64>, i8)
78
79 define <4 x i64> @test_mask_mullo_epi64_rr_256(<4 x i64> %a, <4 x i64> %b) {
80   ;CHECK-LABEL: test_mask_mullo_epi64_rr_256
81   ;CHECK: vpmullq %ymm1, %ymm0, %ymm0     ## encoding: [0x62,0xf2,0xfd,0x28,0x40,0xc1]
82   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 -1)
83   ret <4 x i64> %res
84 }
85
86 define <4 x i64> @test_mask_mullo_epi64_rrk_256(<4 x i64> %a, <4 x i64> %b, <4 x i64> %passThru, i8 %mask) {
87   ;CHECK-LABEL: test_mask_mullo_epi64_rrk_256
88   ;CHECK: vpmullq %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf2,0xfd,0x29,0x40,0xd1]
89   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> %passThru, i8 %mask)
90   ret <4 x i64> %res
91 }
92
93 define <4 x i64> @test_mask_mullo_epi64_rrkz_256(<4 x i64> %a, <4 x i64> %b, i8 %mask) {
94   ;CHECK-LABEL: test_mask_mullo_epi64_rrkz_256
95   ;CHECK: vpmullq %ymm1, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xa9,0x40,0xc1]
96   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 %mask)
97   ret <4 x i64> %res
98 }
99
100 define <4 x i64> @test_mask_mullo_epi64_rm_256(<4 x i64> %a, <4 x i64>* %ptr_b) {
101   ;CHECK-LABEL: test_mask_mullo_epi64_rm_256
102   ;CHECK: vpmullq (%rdi), %ymm0, %ymm0    ## encoding: [0x62,0xf2,0xfd,0x28,0x40,0x07]
103   %b = load <4 x i64>, <4 x i64>* %ptr_b
104   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 -1)
105   ret <4 x i64> %res
106 }
107
108 define <4 x i64> @test_mask_mullo_epi64_rmk_256(<4 x i64> %a, <4 x i64>* %ptr_b, <4 x i64> %passThru, i8 %mask) {
109   ;CHECK-LABEL: test_mask_mullo_epi64_rmk_256
110   ;CHECK: vpmullq (%rdi), %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x29,0x40,0x0f]
111   %b = load <4 x i64>, <4 x i64>* %ptr_b
112   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> %passThru, i8 %mask)
113   ret <4 x i64> %res
114 }
115
116 define <4 x i64> @test_mask_mullo_epi64_rmkz_256(<4 x i64> %a, <4 x i64>* %ptr_b, i8 %mask) {
117   ;CHECK-LABEL: test_mask_mullo_epi64_rmkz_256
118   ;CHECK: vpmullq (%rdi), %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xa9,0x40,0x07]
119   %b = load <4 x i64>, <4 x i64>* %ptr_b
120   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 %mask)
121   ret <4 x i64> %res
122 }
123
124 define <4 x i64> @test_mask_mullo_epi64_rmb_256(<4 x i64> %a, i64* %ptr_b) {
125   ;CHECK-LABEL: test_mask_mullo_epi64_rmb_256
126   ;CHECK: vpmullq (%rdi){1to4}, %ymm0, %ymm0  ## encoding: [0x62,0xf2,0xfd,0x38,0x40,0x07]
127   %q = load i64, i64* %ptr_b
128   %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0
129   %b = shufflevector <4 x i64> %vecinit.i, <4 x i64> undef, <4 x i32> zeroinitializer
130   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 -1)
131   ret <4 x i64> %res
132 }
133
134 define <4 x i64> @test_mask_mullo_epi64_rmbk_256(<4 x i64> %a, i64* %ptr_b, <4 x i64> %passThru, i8 %mask) {
135   ;CHECK-LABEL: test_mask_mullo_epi64_rmbk_256
136   ;CHECK: vpmullq (%rdi){1to4}, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x39,0x40,0x0f]
137   %q = load i64, i64* %ptr_b
138   %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0
139   %b = shufflevector <4 x i64> %vecinit.i, <4 x i64> undef, <4 x i32> zeroinitializer
140   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> %passThru, i8 %mask)
141   ret <4 x i64> %res
142 }
143
144 define <4 x i64> @test_mask_mullo_epi64_rmbkz_256(<4 x i64> %a, i64* %ptr_b, i8 %mask) {
145   ;CHECK-LABEL: test_mask_mullo_epi64_rmbkz_256
146   ;CHECK: vpmullq (%rdi){1to4}, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0xb9,0x40,0x07]
147   %q = load i64, i64* %ptr_b
148   %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0
149   %b = shufflevector <4 x i64> %vecinit.i, <4 x i64> undef, <4 x i32> zeroinitializer
150   %res = call <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64> %a, <4 x i64> %b, <4 x i64> zeroinitializer, i8 %mask)
151   ret <4 x i64> %res
152 }
153
154 declare <4 x i64> @llvm.x86.avx512.mask.pmull.q.256(<4 x i64>, <4 x i64>, <4 x i64>, i8)
155
156 define <2 x i64> @test_mask_mullo_epi64_rr_128(<2 x i64> %a, <2 x i64> %b) {
157   ;CHECK-LABEL: test_mask_mullo_epi64_rr_128
158   ;CHECK: vpmullq %xmm1, %xmm0, %xmm0     ## encoding: [0x62,0xf2,0xfd,0x08,0x40,0xc1]
159   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 -1)
160   ret <2 x i64> %res
161 }
162
163 define <2 x i64> @test_mask_mullo_epi64_rrk_128(<2 x i64> %a, <2 x i64> %b, <2 x i64> %passThru, i8 %mask) {
164   ;CHECK-LABEL: test_mask_mullo_epi64_rrk_128
165   ;CHECK: vpmullq %xmm1, %xmm0, %xmm2 {%k1} ## encoding: [0x62,0xf2,0xfd,0x09,0x40,0xd1]
166   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> %passThru, i8 %mask)
167   ret <2 x i64> %res
168 }
169
170 define <2 x i64> @test_mask_mullo_epi64_rrkz_128(<2 x i64> %a, <2 x i64> %b, i8 %mask) {
171   ;CHECK-LABEL: test_mask_mullo_epi64_rrkz_128
172   ;CHECK: vpmullq %xmm1, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0x89,0x40,0xc1]
173   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 %mask)
174   ret <2 x i64> %res
175 }
176
177 define <2 x i64> @test_mask_mullo_epi64_rm_128(<2 x i64> %a, <2 x i64>* %ptr_b) {
178   ;CHECK-LABEL: test_mask_mullo_epi64_rm_128
179   ;CHECK: vpmullq (%rdi), %xmm0, %xmm0    ## encoding: [0x62,0xf2,0xfd,0x08,0x40,0x07]
180   %b = load <2 x i64>, <2 x i64>* %ptr_b
181   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 -1)
182   ret <2 x i64> %res
183 }
184
185 define <2 x i64> @test_mask_mullo_epi64_rmk_128(<2 x i64> %a, <2 x i64>* %ptr_b, <2 x i64> %passThru, i8 %mask) {
186   ;CHECK-LABEL: test_mask_mullo_epi64_rmk_128
187   ;CHECK: vpmullq (%rdi), %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x09,0x40,0x0f]
188   %b = load <2 x i64>, <2 x i64>* %ptr_b
189   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> %passThru, i8 %mask)
190   ret <2 x i64> %res
191 }
192
193 define <2 x i64> @test_mask_mullo_epi64_rmkz_128(<2 x i64> %a, <2 x i64>* %ptr_b, i8 %mask) {
194   ;CHECK-LABEL: test_mask_mullo_epi64_rmkz_128
195   ;CHECK: vpmullq (%rdi), %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0x89,0x40,0x07]
196   %b = load <2 x i64>, <2 x i64>* %ptr_b
197   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 %mask)
198   ret <2 x i64> %res
199 }
200
201 define <2 x i64> @test_mask_mullo_epi64_rmb_128(<2 x i64> %a, i64* %ptr_b) {
202   ;CHECK-LABEL: test_mask_mullo_epi64_rmb_128
203   ;CHECK: vpmullq (%rdi){1to2}, %xmm0, %xmm0  ## encoding: [0x62,0xf2,0xfd,0x18,0x40,0x07]
204   %q = load i64, i64* %ptr_b
205   %vecinit.i = insertelement <2 x i64> undef, i64 %q, i32 0
206   %b = shufflevector <2 x i64> %vecinit.i, <2 x i64> undef, <2 x i32> zeroinitializer
207   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 -1)
208   ret <2 x i64> %res
209 }
210
211 define <2 x i64> @test_mask_mullo_epi64_rmbk_128(<2 x i64> %a, i64* %ptr_b, <2 x i64> %passThru, i8 %mask) {
212   ;CHECK-LABEL: test_mask_mullo_epi64_rmbk_128
213   ;CHECK: vpmullq (%rdi){1to2}, %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf2,0xfd,0x19,0x40,0x0f]
214   %q = load i64, i64* %ptr_b
215   %vecinit.i = insertelement <2 x i64> undef, i64 %q, i32 0
216   %b = shufflevector <2 x i64> %vecinit.i, <2 x i64> undef, <2 x i32> zeroinitializer
217   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> %passThru, i8 %mask)
218   ret <2 x i64> %res
219 }
220
221 define <2 x i64> @test_mask_mullo_epi64_rmbkz_128(<2 x i64> %a, i64* %ptr_b, i8 %mask) {
222   ;CHECK-LABEL: test_mask_mullo_epi64_rmbkz_128
223   ;CHECK: vpmullq (%rdi){1to2}, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf2,0xfd,0x99,0x40,0x07]
224   %q = load i64, i64* %ptr_b
225   %vecinit.i = insertelement <2 x i64> undef, i64 %q, i32 0
226   %b = shufflevector <2 x i64> %vecinit.i, <2 x i64> undef, <2 x i32> zeroinitializer
227   %res = call <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64> %a, <2 x i64> %b, <2 x i64> zeroinitializer, i8 %mask)
228   ret <2 x i64> %res
229 }
230
231 declare <2 x i64> @llvm.x86.avx512.mask.pmull.q.128(<2 x i64>, <2 x i64>, <2 x i64>, i8)
232
233 define <4 x float> @test_mask_andnot_ps_rr_128(<4 x float> %a, <4 x float> %b) {
234   ;CHECK-LABEL: test_mask_andnot_ps_rr_128
235   ;CHECK: vandnps %xmm1, %xmm0, %xmm0     ## encoding: [0x62,0xf1,0x7c,0x08,0x55,0xc1]
236   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
237   ret <4 x float> %res
238 }
239
240 define <4 x float> @test_mask_andnot_ps_rrk_128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask) {
241   ;CHECK-LABEL: test_mask_andnot_ps_rrk_128
242   ;CHECK: vandnps %xmm1, %xmm0, %xmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x55,0xd1]
243   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
244   ret <4 x float> %res
245 }
246
247 define <4 x float> @test_mask_andnot_ps_rrkz_128(<4 x float> %a, <4 x float> %b, i8 %mask) {
248   ;CHECK-LABEL: test_mask_andnot_ps_rrkz_128
249   ;CHECK: vandnps %xmm1, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x55,0xc1]
250   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
251   ret <4 x float> %res
252 }
253
254 define <4 x float> @test_mask_andnot_ps_rm_128(<4 x float> %a, <4 x float>* %ptr_b) {
255   ;CHECK-LABEL: test_mask_andnot_ps_rm_128
256   ;CHECK: vandnps (%rdi), %xmm0, %xmm0    ## encoding: [0x62,0xf1,0x7c,0x08,0x55,0x07]
257   %b = load <4 x float>, <4 x float>* %ptr_b
258   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
259   ret <4 x float> %res
260 }
261
262 define <4 x float> @test_mask_andnot_ps_rmk_128(<4 x float> %a, <4 x float>* %ptr_b, <4 x float> %passThru, i8 %mask) {
263   ;CHECK-LABEL: test_mask_andnot_ps_rmk_128
264   ;CHECK: vandnps (%rdi), %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x55,0x0f]
265   %b = load <4 x float>, <4 x float>* %ptr_b
266   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
267   ret <4 x float> %res
268 }
269
270 define <4 x float> @test_mask_andnot_ps_rmkz_128(<4 x float> %a, <4 x float>* %ptr_b, i8 %mask) {
271   ;CHECK-LABEL: test_mask_andnot_ps_rmkz_128
272   ;CHECK: vandnps (%rdi), %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x55,0x07]
273   %b = load <4 x float>, <4 x float>* %ptr_b
274   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
275   ret <4 x float> %res
276 }
277
278 define <4 x float> @test_mask_andnot_ps_rmb_128(<4 x float> %a, float* %ptr_b) {
279   ;CHECK-LABEL: test_mask_andnot_ps_rmb_128
280   ;CHECK: vandnps (%rdi){1to4}, %xmm0, %xmm0  ## encoding: [0x62,0xf1,0x7c,0x18,0x55,0x07]
281   %q = load float, float* %ptr_b
282   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
283   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
284   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
285   ret <4 x float> %res
286 }
287
288 define <4 x float> @test_mask_andnot_ps_rmbk_128(<4 x float> %a, float* %ptr_b, <4 x float> %passThru, i8 %mask) {
289   ;CHECK-LABEL: test_mask_andnot_ps_rmbk_128
290   ;CHECK: vandnps (%rdi){1to4}, %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x19,0x55,0x0f]
291   %q = load float, float* %ptr_b
292   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
293   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
294   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
295   ret <4 x float> %res
296 }
297
298 define <4 x float> @test_mask_andnot_ps_rmbkz_128(<4 x float> %a, float* %ptr_b, i8 %mask) {
299   ;CHECK-LABEL: test_mask_andnot_ps_rmbkz_128
300   ;CHECK: vandnps (%rdi){1to4}, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x99,0x55,0x07]
301   %q = load float, float* %ptr_b
302   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
303   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
304   %res = call <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
305   ret <4 x float> %res
306 }
307
308 declare <4 x float> @llvm.x86.avx512.mask.andn.ps.128(<4 x float>, <4 x float>, <4 x float>, i8)
309
310 define <8 x float> @test_mask_andnot_ps_rr_256(<8 x float> %a, <8 x float> %b) {
311   ;CHECK-LABEL: test_mask_andnot_ps_rr_256
312   ;CHECK: vandnps %ymm1, %ymm0, %ymm0     ## encoding: [0x62,0xf1,0x7c,0x28,0x55,0xc1]
313   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
314   ret <8 x float> %res
315 }
316
317 define <8 x float> @test_mask_andnot_ps_rrk_256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask) {
318   ;CHECK-LABEL: test_mask_andnot_ps_rrk_256
319   ;CHECK: vandnps %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x55,0xd1]
320   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
321   ret <8 x float> %res
322 }
323
324 define <8 x float> @test_mask_andnot_ps_rrkz_256(<8 x float> %a, <8 x float> %b, i8 %mask) {
325   ;CHECK-LABEL: test_mask_andnot_ps_rrkz_256
326   ;CHECK: vandnps %ymm1, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x55,0xc1]
327   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
328   ret <8 x float> %res
329 }
330
331 define <8 x float> @test_mask_andnot_ps_rm_256(<8 x float> %a, <8 x float>* %ptr_b) {
332   ;CHECK-LABEL: test_mask_andnot_ps_rm_256
333   ;CHECK: vandnps (%rdi), %ymm0, %ymm0    ## encoding: [0x62,0xf1,0x7c,0x28,0x55,0x07]
334   %b = load <8 x float>, <8 x float>* %ptr_b
335   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
336   ret <8 x float> %res
337 }
338
339 define <8 x float> @test_mask_andnot_ps_rmk_256(<8 x float> %a, <8 x float>* %ptr_b, <8 x float> %passThru, i8 %mask) {
340   ;CHECK-LABEL: test_mask_andnot_ps_rmk_256
341   ;CHECK: vandnps (%rdi), %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x55,0x0f]
342   %b = load <8 x float>, <8 x float>* %ptr_b
343   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
344   ret <8 x float> %res
345 }
346
347 define <8 x float> @test_mask_andnot_ps_rmkz_256(<8 x float> %a, <8 x float>* %ptr_b, i8 %mask) {
348   ;CHECK-LABEL: test_mask_andnot_ps_rmkz_256
349   ;CHECK: vandnps (%rdi), %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x55,0x07]
350   %b = load <8 x float>, <8 x float>* %ptr_b
351   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
352   ret <8 x float> %res
353 }
354
355 define <8 x float> @test_mask_andnot_ps_rmb_256(<8 x float> %a, float* %ptr_b) {
356   ;CHECK-LABEL: test_mask_andnot_ps_rmb_256
357   ;CHECK: vandnps (%rdi){1to8}, %ymm0, %ymm0  ## encoding: [0x62,0xf1,0x7c,0x38,0x55,0x07]
358   %q = load float, float* %ptr_b
359   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
360   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
361   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
362   ret <8 x float> %res
363 }
364
365 define <8 x float> @test_mask_andnot_ps_rmbk_256(<8 x float> %a, float* %ptr_b, <8 x float> %passThru, i8 %mask) {
366   ;CHECK-LABEL: test_mask_andnot_ps_rmbk_256
367   ;CHECK: vandnps (%rdi){1to8}, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x39,0x55,0x0f]
368   %q = load float, float* %ptr_b
369   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
370   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
371   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
372   ret <8 x float> %res
373 }
374
375 define <8 x float> @test_mask_andnot_ps_rmbkz_256(<8 x float> %a, float* %ptr_b, i8 %mask) {
376   ;CHECK-LABEL: test_mask_andnot_ps_rmbkz_256
377   ;CHECK: vandnps (%rdi){1to8}, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xb9,0x55,0x07]
378   %q = load float, float* %ptr_b
379   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
380   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
381   %res = call <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
382   ret <8 x float> %res
383 }
384
385 declare <8 x float> @llvm.x86.avx512.mask.andn.ps.256(<8 x float>, <8 x float>, <8 x float>, i8)
386
387 define <16 x float> @test_mask_andnot_ps_rr_512(<16 x float> %a, <16 x float> %b) {
388   ;CHECK-LABEL: test_mask_andnot_ps_rr_512
389   ;CHECK: vandnps %zmm1, %zmm0, %zmm0     ## encoding: [0x62,0xf1,0x7c,0x48,0x55,0xc1]
390   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
391   ret <16 x float> %res
392 }
393
394 define <16 x float> @test_mask_andnot_ps_rrk_512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask) {
395   ;CHECK-LABEL: test_mask_andnot_ps_rrk_512
396   ;CHECK: vandnps %zmm1, %zmm0, %zmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x55,0xd1]
397   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
398   ret <16 x float> %res
399 }
400
401 define <16 x float> @test_mask_andnot_ps_rrkz_512(<16 x float> %a, <16 x float> %b, i16 %mask) {
402   ;CHECK-LABEL: test_mask_andnot_ps_rrkz_512
403   ;CHECK: vandnps %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x55,0xc1]
404   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
405   ret <16 x float> %res
406 }
407
408 define <16 x float> @test_mask_andnot_ps_rm_512(<16 x float> %a, <16 x float>* %ptr_b) {
409   ;CHECK-LABEL: test_mask_andnot_ps_rm_512
410   ;CHECK: vandnps (%rdi), %zmm0, %zmm0    ## encoding: [0x62,0xf1,0x7c,0x48,0x55,0x07]
411   %b = load <16 x float>, <16 x float>* %ptr_b
412   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
413   ret <16 x float> %res
414 }
415
416 define <16 x float> @test_mask_andnot_ps_rmk_512(<16 x float> %a, <16 x float>* %ptr_b, <16 x float> %passThru, i16 %mask) {
417   ;CHECK-LABEL: test_mask_andnot_ps_rmk_512
418   ;CHECK: vandnps (%rdi), %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x55,0x0f]
419   %b = load <16 x float>, <16 x float>* %ptr_b
420   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
421   ret <16 x float> %res
422 }
423
424 define <16 x float> @test_mask_andnot_ps_rmkz_512(<16 x float> %a, <16 x float>* %ptr_b, i16 %mask) {
425   ;CHECK-LABEL: test_mask_andnot_ps_rmkz_512
426   ;CHECK: vandnps (%rdi), %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x55,0x07]
427   %b = load <16 x float>, <16 x float>* %ptr_b
428   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
429   ret <16 x float> %res
430 }
431
432 define <16 x float> @test_mask_andnot_ps_rmb_512(<16 x float> %a, float* %ptr_b) {
433   ;CHECK-LABEL: test_mask_andnot_ps_rmb_512
434   ;CHECK: vandnps (%rdi){1to16}, %zmm0, %zmm0  ## encoding: [0x62,0xf1,0x7c,0x58,0x55,0x07]
435   %q = load float, float* %ptr_b
436   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
437   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
438   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
439   ret <16 x float> %res
440 }
441
442 define <16 x float> @test_mask_andnot_ps_rmbk_512(<16 x float> %a, float* %ptr_b, <16 x float> %passThru, i16 %mask) {
443   ;CHECK-LABEL: test_mask_andnot_ps_rmbk_512
444   ;CHECK: vandnps (%rdi){1to16}, %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x59,0x55,0x0f]
445   %q = load float, float* %ptr_b
446   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
447   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
448   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
449   ret <16 x float> %res
450 }
451
452 define <16 x float> @test_mask_andnot_ps_rmbkz_512(<16 x float> %a, float* %ptr_b, i16 %mask) {
453   ;CHECK-LABEL: test_mask_andnot_ps_rmbkz_512
454   ;CHECK: vandnps (%rdi){1to16}, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xd9,0x55,0x07]
455   %q = load float, float* %ptr_b
456   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
457   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
458   %res = call <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
459   ret <16 x float> %res
460 }
461
462 declare <16 x float> @llvm.x86.avx512.mask.andn.ps.512(<16 x float>, <16 x float>, <16 x float>, i16)
463
464 define <4 x float> @test_mask_and_ps_rr_128(<4 x float> %a, <4 x float> %b) {
465   ;CHECK-LABEL: test_mask_and_ps_rr_128
466   ;CHECK: vandps  %xmm1, %xmm0, %xmm0     ## encoding: [0x62,0xf1,0x7c,0x08,0x54,0xc1]
467   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
468   ret <4 x float> %res
469 }
470
471 define <4 x float> @test_mask_and_ps_rrk_128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask) {
472   ;CHECK-LABEL: test_mask_and_ps_rrk_128
473   ;CHECK: vandps %xmm1, %xmm0, %xmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x54,0xd1]
474   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
475   ret <4 x float> %res
476 }
477
478 define <4 x float> @test_mask_and_ps_rrkz_128(<4 x float> %a, <4 x float> %b, i8 %mask) {
479   ;CHECK-LABEL: test_mask_and_ps_rrkz_128
480   ;CHECK: vandps %xmm1, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x54,0xc1]
481   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
482   ret <4 x float> %res
483 }
484
485 define <4 x float> @test_mask_and_ps_rm_128(<4 x float> %a, <4 x float>* %ptr_b) {
486   ;CHECK-LABEL: test_mask_and_ps_rm_128
487   ;CHECK: vandps (%rdi), %xmm0, %xmm0    ## encoding: [0x62,0xf1,0x7c,0x08,0x54,0x07]
488   %b = load <4 x float>, <4 x float>* %ptr_b
489   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
490   ret <4 x float> %res
491 }
492
493 define <4 x float> @test_mask_and_ps_rmk_128(<4 x float> %a, <4 x float>* %ptr_b, <4 x float> %passThru, i8 %mask) {
494   ;CHECK-LABEL: test_mask_and_ps_rmk_128
495   ;CHECK: vandps (%rdi), %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x54,0x0f]
496   %b = load <4 x float>, <4 x float>* %ptr_b
497   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
498   ret <4 x float> %res
499 }
500
501 define <4 x float> @test_mask_and_ps_rmkz_128(<4 x float> %a, <4 x float>* %ptr_b, i8 %mask) {
502   ;CHECK-LABEL: test_mask_and_ps_rmkz_128
503   ;CHECK: vandps (%rdi), %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x54,0x07]
504   %b = load <4 x float>, <4 x float>* %ptr_b
505   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
506   ret <4 x float> %res
507 }
508
509 define <4 x float> @test_mask_and_ps_rmb_128(<4 x float> %a, float* %ptr_b) {
510   ;CHECK-LABEL: test_mask_and_ps_rmb_128
511   ;CHECK: vandps (%rdi){1to4}, %xmm0, %xmm0  ## encoding: [0x62,0xf1,0x7c,0x18,0x54,0x07]
512   %q = load float, float* %ptr_b
513   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
514   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
515   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
516   ret <4 x float> %res
517 }
518
519 define <4 x float> @test_mask_and_ps_rmbk_128(<4 x float> %a, float* %ptr_b, <4 x float> %passThru, i8 %mask) {
520   ;CHECK-LABEL: test_mask_and_ps_rmbk_128
521   ;CHECK: vandps (%rdi){1to4}, %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x19,0x54,0x0f]
522   %q = load float, float* %ptr_b
523   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
524   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
525   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
526   ret <4 x float> %res
527 }
528
529 define <4 x float> @test_mask_and_ps_rmbkz_128(<4 x float> %a, float* %ptr_b, i8 %mask) {
530   ;CHECK-LABEL: test_mask_and_ps_rmbkz_128
531   ;CHECK: vandps (%rdi){1to4}, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x99,0x54,0x07]
532   %q = load float, float* %ptr_b
533   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
534   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
535   %res = call <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
536   ret <4 x float> %res
537 }
538
539 declare <4 x float> @llvm.x86.avx512.mask.and.ps.128(<4 x float>, <4 x float>, <4 x float>, i8)
540
541 define <8 x float> @test_mask_and_ps_rr_256(<8 x float> %a, <8 x float> %b) {
542   ;CHECK-LABEL: test_mask_and_ps_rr_256
543   ;CHECK: vandps %ymm1, %ymm0, %ymm0     ## encoding: [0x62,0xf1,0x7c,0x28,0x54,0xc1]
544   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
545   ret <8 x float> %res
546 }
547
548 define <8 x float> @test_mask_and_ps_rrk_256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask) {
549   ;CHECK-LABEL: test_mask_and_ps_rrk_256
550   ;CHECK: vandps %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x54,0xd1]
551   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
552   ret <8 x float> %res
553 }
554
555 define <8 x float> @test_mask_and_ps_rrkz_256(<8 x float> %a, <8 x float> %b, i8 %mask) {
556   ;CHECK-LABEL: test_mask_and_ps_rrkz_256
557   ;CHECK: vandps %ymm1, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x54,0xc1]
558   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
559   ret <8 x float> %res
560 }
561
562 define <8 x float> @test_mask_and_ps_rm_256(<8 x float> %a, <8 x float>* %ptr_b) {
563   ;CHECK-LABEL: test_mask_and_ps_rm_256
564   ;CHECK: vandps (%rdi), %ymm0, %ymm0    ## encoding: [0x62,0xf1,0x7c,0x28,0x54,0x07]
565   %b = load <8 x float>, <8 x float>* %ptr_b
566   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
567   ret <8 x float> %res
568 }
569
570 define <8 x float> @test_mask_and_ps_rmk_256(<8 x float> %a, <8 x float>* %ptr_b, <8 x float> %passThru, i8 %mask) {
571   ;CHECK-LABEL: test_mask_and_ps_rmk_256
572   ;CHECK: vandps (%rdi), %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x54,0x0f]
573   %b = load <8 x float>, <8 x float>* %ptr_b
574   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
575   ret <8 x float> %res
576 }
577
578 define <8 x float> @test_mask_and_ps_rmkz_256(<8 x float> %a, <8 x float>* %ptr_b, i8 %mask) {
579   ;CHECK-LABEL: test_mask_and_ps_rmkz_256
580   ;CHECK: vandps (%rdi), %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x54,0x07]
581   %b = load <8 x float>, <8 x float>* %ptr_b
582   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
583   ret <8 x float> %res
584 }
585
586 define <8 x float> @test_mask_and_ps_rmb_256(<8 x float> %a, float* %ptr_b) {
587   ;CHECK-LABEL: test_mask_and_ps_rmb_256
588   ;CHECK: vandps (%rdi){1to8}, %ymm0, %ymm0  ## encoding: [0x62,0xf1,0x7c,0x38,0x54,0x07]
589   %q = load float, float* %ptr_b
590   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
591   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
592   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
593   ret <8 x float> %res
594 }
595
596 define <8 x float> @test_mask_and_ps_rmbk_256(<8 x float> %a, float* %ptr_b, <8 x float> %passThru, i8 %mask) {
597   ;CHECK-LABEL: test_mask_and_ps_rmbk_256
598   ;CHECK: vandps (%rdi){1to8}, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x39,0x54,0x0f]
599   %q = load float, float* %ptr_b
600   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
601   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
602   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
603   ret <8 x float> %res
604 }
605
606 define <8 x float> @test_mask_and_ps_rmbkz_256(<8 x float> %a, float* %ptr_b, i8 %mask) {
607   ;CHECK-LABEL: test_mask_and_ps_rmbkz_256
608   ;CHECK: vandps (%rdi){1to8}, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xb9,0x54,0x07]
609   %q = load float, float* %ptr_b
610   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
611   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
612   %res = call <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
613   ret <8 x float> %res
614 }
615
616 declare <8 x float> @llvm.x86.avx512.mask.and.ps.256(<8 x float>, <8 x float>, <8 x float>, i8)
617
618 define <16 x float> @test_mask_and_ps_rr_512(<16 x float> %a, <16 x float> %b) {
619   ;CHECK-LABEL: test_mask_and_ps_rr_512
620   ;CHECK: vandps %zmm1, %zmm0, %zmm0     ## encoding: [0x62,0xf1,0x7c,0x48,0x54,0xc1]
621   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
622   ret <16 x float> %res
623 }
624
625 define <16 x float> @test_mask_and_ps_rrk_512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask) {
626   ;CHECK-LABEL: test_mask_and_ps_rrk_512
627   ;CHECK: vandps %zmm1, %zmm0, %zmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x54,0xd1]
628   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
629   ret <16 x float> %res
630 }
631
632 define <16 x float> @test_mask_and_ps_rrkz_512(<16 x float> %a, <16 x float> %b, i16 %mask) {
633   ;CHECK-LABEL: test_mask_and_ps_rrkz_512
634   ;CHECK: vandps %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x54,0xc1]
635   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
636   ret <16 x float> %res
637 }
638
639 define <16 x float> @test_mask_and_ps_rm_512(<16 x float> %a, <16 x float>* %ptr_b) {
640   ;CHECK-LABEL: test_mask_and_ps_rm_512
641   ;CHECK: vandps (%rdi), %zmm0, %zmm0    ## encoding: [0x62,0xf1,0x7c,0x48,0x54,0x07]
642   %b = load <16 x float>, <16 x float>* %ptr_b
643   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
644   ret <16 x float> %res
645 }
646
647 define <16 x float> @test_mask_and_ps_rmk_512(<16 x float> %a, <16 x float>* %ptr_b, <16 x float> %passThru, i16 %mask) {
648   ;CHECK-LABEL: test_mask_and_ps_rmk_512
649   ;CHECK: vandps (%rdi), %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x54,0x0f]
650   %b = load <16 x float>, <16 x float>* %ptr_b
651   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
652   ret <16 x float> %res
653 }
654
655 define <16 x float> @test_mask_and_ps_rmkz_512(<16 x float> %a, <16 x float>* %ptr_b, i16 %mask) {
656   ;CHECK-LABEL: test_mask_and_ps_rmkz_512
657   ;CHECK: vandps (%rdi), %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x54,0x07]
658   %b = load <16 x float>, <16 x float>* %ptr_b
659   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
660   ret <16 x float> %res
661 }
662
663 define <16 x float> @test_mask_and_ps_rmb_512(<16 x float> %a, float* %ptr_b) {
664   ;CHECK-LABEL: test_mask_and_ps_rmb_512
665   ;CHECK: vandps (%rdi){1to16}, %zmm0, %zmm0  ## encoding: [0x62,0xf1,0x7c,0x58,0x54,0x07]
666   %q = load float, float* %ptr_b
667   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
668   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
669   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
670   ret <16 x float> %res
671 }
672
673 define <16 x float> @test_mask_and_ps_rmbk_512(<16 x float> %a, float* %ptr_b, <16 x float> %passThru, i16 %mask) {
674   ;CHECK-LABEL: test_mask_and_ps_rmbk_512
675   ;CHECK: vandps (%rdi){1to16}, %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x59,0x54,0x0f]
676   %q = load float, float* %ptr_b
677   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
678   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
679   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
680   ret <16 x float> %res
681 }
682
683 define <16 x float> @test_mask_and_ps_rmbkz_512(<16 x float> %a, float* %ptr_b, i16 %mask) {
684   ;CHECK-LABEL: test_mask_and_ps_rmbkz_512
685   ;CHECK: vandps (%rdi){1to16}, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xd9,0x54,0x07]
686   %q = load float, float* %ptr_b
687   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
688   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
689   %res = call <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
690   ret <16 x float> %res
691 }
692
693 declare <16 x float> @llvm.x86.avx512.mask.and.ps.512(<16 x float>, <16 x float>, <16 x float>, i16)
694
695 define <4 x float> @test_mask_or_ps_rr_128(<4 x float> %a, <4 x float> %b) {
696   ;CHECK-LABEL: test_mask_or_ps_rr_128
697   ;CHECK: vorps  %xmm1, %xmm0, %xmm0     ## encoding: [0x62,0xf1,0x7c,0x08,0x56,0xc1]
698   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
699   ret <4 x float> %res
700 }
701
702 define <4 x float> @test_mask_or_ps_rrk_128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask) {
703   ;CHECK-LABEL: test_mask_or_ps_rrk_128
704   ;CHECK: vorps %xmm1, %xmm0, %xmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x56,0xd1]
705   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
706   ret <4 x float> %res
707 }
708
709 define <4 x float> @test_mask_or_ps_rrkz_128(<4 x float> %a, <4 x float> %b, i8 %mask) {
710   ;CHECK-LABEL: test_mask_or_ps_rrkz_128
711   ;CHECK: vorps %xmm1, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x56,0xc1]
712   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
713   ret <4 x float> %res
714 }
715
716 define <4 x float> @test_mask_or_ps_rm_128(<4 x float> %a, <4 x float>* %ptr_b) {
717   ;CHECK-LABEL: test_mask_or_ps_rm_128
718   ;CHECK: vorps (%rdi), %xmm0, %xmm0    ## encoding: [0x62,0xf1,0x7c,0x08,0x56,0x07]
719   %b = load <4 x float>, <4 x float>* %ptr_b
720   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
721   ret <4 x float> %res
722 }
723
724 define <4 x float> @test_mask_or_ps_rmk_128(<4 x float> %a, <4 x float>* %ptr_b, <4 x float> %passThru, i8 %mask) {
725   ;CHECK-LABEL: test_mask_or_ps_rmk_128
726   ;CHECK: vorps (%rdi), %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x56,0x0f]
727   %b = load <4 x float>, <4 x float>* %ptr_b
728   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
729   ret <4 x float> %res
730 }
731
732 define <4 x float> @test_mask_or_ps_rmkz_128(<4 x float> %a, <4 x float>* %ptr_b, i8 %mask) {
733   ;CHECK-LABEL: test_mask_or_ps_rmkz_128
734   ;CHECK: vorps (%rdi), %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x56,0x07]
735   %b = load <4 x float>, <4 x float>* %ptr_b
736   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
737   ret <4 x float> %res
738 }
739
740 define <4 x float> @test_mask_or_ps_rmb_128(<4 x float> %a, float* %ptr_b) {
741   ;CHECK-LABEL: test_mask_or_ps_rmb_128
742   ;CHECK: vorps (%rdi){1to4}, %xmm0, %xmm0  ## encoding: [0x62,0xf1,0x7c,0x18,0x56,0x07]
743   %q = load float, float* %ptr_b
744   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
745   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
746   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
747   ret <4 x float> %res
748 }
749
750 define <4 x float> @test_mask_or_ps_rmbk_128(<4 x float> %a, float* %ptr_b, <4 x float> %passThru, i8 %mask) {
751   ;CHECK-LABEL: test_mask_or_ps_rmbk_128
752   ;CHECK: vorps (%rdi){1to4}, %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x19,0x56,0x0f]
753   %q = load float, float* %ptr_b
754   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
755   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
756   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
757   ret <4 x float> %res
758 }
759
760 define <4 x float> @test_mask_or_ps_rmbkz_128(<4 x float> %a, float* %ptr_b, i8 %mask) {
761   ;CHECK-LABEL: test_mask_or_ps_rmbkz_128
762   ;CHECK: vorps (%rdi){1to4}, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x99,0x56,0x07]
763   %q = load float, float* %ptr_b
764   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
765   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
766   %res = call <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
767   ret <4 x float> %res
768 }
769
770 declare <4 x float> @llvm.x86.avx512.mask.or.ps.128(<4 x float>, <4 x float>, <4 x float>, i8)
771
772 define <8 x float> @test_mask_or_ps_rr_256(<8 x float> %a, <8 x float> %b) {
773   ;CHECK-LABEL: test_mask_or_ps_rr_256
774   ;CHECK: vorps %ymm1, %ymm0, %ymm0     ## encoding: [0x62,0xf1,0x7c,0x28,0x56,0xc1]
775   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
776   ret <8 x float> %res
777 }
778
779 define <8 x float> @test_mask_or_ps_rrk_256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask) {
780   ;CHECK-LABEL: test_mask_or_ps_rrk_256
781   ;CHECK: vorps %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x56,0xd1]
782   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
783   ret <8 x float> %res
784 }
785
786 define <8 x float> @test_mask_or_ps_rrkz_256(<8 x float> %a, <8 x float> %b, i8 %mask) {
787   ;CHECK-LABEL: test_mask_or_ps_rrkz_256
788   ;CHECK: vorps %ymm1, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x56,0xc1]
789   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
790   ret <8 x float> %res
791 }
792
793 define <8 x float> @test_mask_or_ps_rm_256(<8 x float> %a, <8 x float>* %ptr_b) {
794   ;CHECK-LABEL: test_mask_or_ps_rm_256
795   ;CHECK: vorps (%rdi), %ymm0, %ymm0    ## encoding: [0x62,0xf1,0x7c,0x28,0x56,0x07]
796   %b = load <8 x float>, <8 x float>* %ptr_b
797   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
798   ret <8 x float> %res
799 }
800
801 define <8 x float> @test_mask_or_ps_rmk_256(<8 x float> %a, <8 x float>* %ptr_b, <8 x float> %passThru, i8 %mask) {
802   ;CHECK-LABEL: test_mask_or_ps_rmk_256
803   ;CHECK: vorps (%rdi), %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x56,0x0f]
804   %b = load <8 x float>, <8 x float>* %ptr_b
805   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
806   ret <8 x float> %res
807 }
808
809 define <8 x float> @test_mask_or_ps_rmkz_256(<8 x float> %a, <8 x float>* %ptr_b, i8 %mask) {
810   ;CHECK-LABEL: test_mask_or_ps_rmkz_256
811   ;CHECK: vorps (%rdi), %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x56,0x07]
812   %b = load <8 x float>, <8 x float>* %ptr_b
813   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
814   ret <8 x float> %res
815 }
816
817 define <8 x float> @test_mask_or_ps_rmb_256(<8 x float> %a, float* %ptr_b) {
818   ;CHECK-LABEL: test_mask_or_ps_rmb_256
819   ;CHECK: vorps (%rdi){1to8}, %ymm0, %ymm0  ## encoding: [0x62,0xf1,0x7c,0x38,0x56,0x07]
820   %q = load float, float* %ptr_b
821   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
822   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
823   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
824   ret <8 x float> %res
825 }
826
827 define <8 x float> @test_mask_or_ps_rmbk_256(<8 x float> %a, float* %ptr_b, <8 x float> %passThru, i8 %mask) {
828   ;CHECK-LABEL: test_mask_or_ps_rmbk_256
829   ;CHECK: vorps (%rdi){1to8}, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x39,0x56,0x0f]
830   %q = load float, float* %ptr_b
831   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
832   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
833   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
834   ret <8 x float> %res
835 }
836
837 define <8 x float> @test_mask_or_ps_rmbkz_256(<8 x float> %a, float* %ptr_b, i8 %mask) {
838   ;CHECK-LABEL: test_mask_or_ps_rmbkz_256
839   ;CHECK: vorps (%rdi){1to8}, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xb9,0x56,0x07]
840   %q = load float, float* %ptr_b
841   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
842   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
843   %res = call <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
844   ret <8 x float> %res
845 }
846
847 declare <8 x float> @llvm.x86.avx512.mask.or.ps.256(<8 x float>, <8 x float>, <8 x float>, i8)
848
849 define <16 x float> @test_mask_or_ps_rr_512(<16 x float> %a, <16 x float> %b) {
850   ;CHECK-LABEL: test_mask_or_ps_rr_512
851   ;CHECK: vorps %zmm1, %zmm0, %zmm0     ## encoding: [0x62,0xf1,0x7c,0x48,0x56,0xc1]
852   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
853   ret <16 x float> %res
854 }
855
856 define <16 x float> @test_mask_or_ps_rrk_512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask) {
857   ;CHECK-LABEL: test_mask_or_ps_rrk_512
858   ;CHECK: vorps %zmm1, %zmm0, %zmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x56,0xd1]
859   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
860   ret <16 x float> %res
861 }
862
863 define <16 x float> @test_mask_or_ps_rrkz_512(<16 x float> %a, <16 x float> %b, i16 %mask) {
864   ;CHECK-LABEL: test_mask_or_ps_rrkz_512
865   ;CHECK: vorps %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x56,0xc1]
866   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
867   ret <16 x float> %res
868 }
869
870 define <16 x float> @test_mask_or_ps_rm_512(<16 x float> %a, <16 x float>* %ptr_b) {
871   ;CHECK-LABEL: test_mask_or_ps_rm_512
872   ;CHECK: vorps (%rdi), %zmm0, %zmm0    ## encoding: [0x62,0xf1,0x7c,0x48,0x56,0x07]
873   %b = load <16 x float>, <16 x float>* %ptr_b
874   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
875   ret <16 x float> %res
876 }
877
878 define <16 x float> @test_mask_or_ps_rmk_512(<16 x float> %a, <16 x float>* %ptr_b, <16 x float> %passThru, i16 %mask) {
879   ;CHECK-LABEL: test_mask_or_ps_rmk_512
880   ;CHECK: vorps (%rdi), %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x56,0x0f]
881   %b = load <16 x float>, <16 x float>* %ptr_b
882   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
883   ret <16 x float> %res
884 }
885
886 define <16 x float> @test_mask_or_ps_rmkz_512(<16 x float> %a, <16 x float>* %ptr_b, i16 %mask) {
887   ;CHECK-LABEL: test_mask_or_ps_rmkz_512
888   ;CHECK: vorps (%rdi), %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x56,0x07]
889   %b = load <16 x float>, <16 x float>* %ptr_b
890   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
891   ret <16 x float> %res
892 }
893
894 define <16 x float> @test_mask_or_ps_rmb_512(<16 x float> %a, float* %ptr_b) {
895   ;CHECK-LABEL: test_mask_or_ps_rmb_512
896   ;CHECK: vorps (%rdi){1to16}, %zmm0, %zmm0  ## encoding: [0x62,0xf1,0x7c,0x58,0x56,0x07]
897   %q = load float, float* %ptr_b
898   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
899   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
900   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
901   ret <16 x float> %res
902 }
903
904 define <16 x float> @test_mask_or_ps_rmbk_512(<16 x float> %a, float* %ptr_b, <16 x float> %passThru, i16 %mask) {
905   ;CHECK-LABEL: test_mask_or_ps_rmbk_512
906   ;CHECK: vorps (%rdi){1to16}, %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x59,0x56,0x0f]
907   %q = load float, float* %ptr_b
908   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
909   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
910   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
911   ret <16 x float> %res
912 }
913
914 define <16 x float> @test_mask_or_ps_rmbkz_512(<16 x float> %a, float* %ptr_b, i16 %mask) {
915   ;CHECK-LABEL: test_mask_or_ps_rmbkz_512
916   ;CHECK: vorps (%rdi){1to16}, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xd9,0x56,0x07]
917   %q = load float, float* %ptr_b
918   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
919   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
920   %res = call <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
921   ret <16 x float> %res
922 }
923
924 declare <16 x float> @llvm.x86.avx512.mask.or.ps.512(<16 x float>, <16 x float>, <16 x float>, i16)
925
926 define <4 x float> @test_mask_xor_ps_rr_128(<4 x float> %a, <4 x float> %b) {
927   ;CHECK-LABEL: test_mask_xor_ps_rr_128
928   ;CHECK: vxorps  %xmm1, %xmm0, %xmm0     ## encoding: [0x62,0xf1,0x7c,0x08,0x57,0xc1]
929   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
930   ret <4 x float> %res
931 }
932
933 define <4 x float> @test_mask_xor_ps_rrk_128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask) {
934   ;CHECK-LABEL: test_mask_xor_ps_rrk_128
935   ;CHECK: vxorps %xmm1, %xmm0, %xmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x57,0xd1]
936   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
937   ret <4 x float> %res
938 }
939
940 define <4 x float> @test_mask_xor_ps_rrkz_128(<4 x float> %a, <4 x float> %b, i8 %mask) {
941   ;CHECK-LABEL: test_mask_xor_ps_rrkz_128
942   ;CHECK: vxorps %xmm1, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x57,0xc1]
943   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
944   ret <4 x float> %res
945 }
946
947 define <4 x float> @test_mask_xor_ps_rm_128(<4 x float> %a, <4 x float>* %ptr_b) {
948   ;CHECK-LABEL: test_mask_xor_ps_rm_128
949   ;CHECK: vxorps (%rdi), %xmm0, %xmm0    ## encoding: [0x62,0xf1,0x7c,0x08,0x57,0x07]
950   %b = load <4 x float>, <4 x float>* %ptr_b
951   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
952   ret <4 x float> %res
953 }
954
955 define <4 x float> @test_mask_xor_ps_rmk_128(<4 x float> %a, <4 x float>* %ptr_b, <4 x float> %passThru, i8 %mask) {
956   ;CHECK-LABEL: test_mask_xor_ps_rmk_128
957   ;CHECK: vxorps (%rdi), %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x09,0x57,0x0f]
958   %b = load <4 x float>, <4 x float>* %ptr_b
959   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
960   ret <4 x float> %res
961 }
962
963 define <4 x float> @test_mask_xor_ps_rmkz_128(<4 x float> %a, <4 x float>* %ptr_b, i8 %mask) {
964   ;CHECK-LABEL: test_mask_xor_ps_rmkz_128
965   ;CHECK: vxorps (%rdi), %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x89,0x57,0x07]
966   %b = load <4 x float>, <4 x float>* %ptr_b
967   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
968   ret <4 x float> %res
969 }
970
971 define <4 x float> @test_mask_xor_ps_rmb_128(<4 x float> %a, float* %ptr_b) {
972   ;CHECK-LABEL: test_mask_xor_ps_rmb_128
973   ;CHECK: vxorps (%rdi){1to4}, %xmm0, %xmm0  ## encoding: [0x62,0xf1,0x7c,0x18,0x57,0x07]
974   %q = load float, float* %ptr_b
975   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
976   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
977   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 -1)
978   ret <4 x float> %res
979 }
980
981 define <4 x float> @test_mask_xor_ps_rmbk_128(<4 x float> %a, float* %ptr_b, <4 x float> %passThru, i8 %mask) {
982   ;CHECK-LABEL: test_mask_xor_ps_rmbk_128
983   ;CHECK: vxorps (%rdi){1to4}, %xmm0, %xmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x19,0x57,0x0f]
984   %q = load float, float* %ptr_b
985   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
986   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
987   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> %passThru, i8 %mask)
988   ret <4 x float> %res
989 }
990
991 define <4 x float> @test_mask_xor_ps_rmbkz_128(<4 x float> %a, float* %ptr_b, i8 %mask) {
992   ;CHECK-LABEL: test_mask_xor_ps_rmbkz_128
993   ;CHECK: vxorps (%rdi){1to4}, %xmm0, %xmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0x99,0x57,0x07]
994   %q = load float, float* %ptr_b
995   %vecinit.i = insertelement <4 x float> undef, float %q, i32 0
996   %b = shufflevector <4 x float> %vecinit.i, <4 x float> undef, <4 x i32> zeroinitializer
997   %res = call <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float> %a, <4 x float> %b, <4 x float> zeroinitializer, i8 %mask)
998   ret <4 x float> %res
999 }
1000
1001 declare <4 x float> @llvm.x86.avx512.mask.xor.ps.128(<4 x float>, <4 x float>, <4 x float>, i8)
1002
1003 define <8 x float> @test_mask_xor_ps_rr_256(<8 x float> %a, <8 x float> %b) {
1004   ;CHECK-LABEL: test_mask_xor_ps_rr_256
1005   ;CHECK: vxorps %ymm1, %ymm0, %ymm0     ## encoding: [0x62,0xf1,0x7c,0x28,0x57,0xc1]
1006   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
1007   ret <8 x float> %res
1008 }
1009
1010 define <8 x float> @test_mask_xor_ps_rrk_256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask) {
1011   ;CHECK-LABEL: test_mask_xor_ps_rrk_256
1012   ;CHECK: vxorps %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x57,0xd1]
1013   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
1014   ret <8 x float> %res
1015 }
1016
1017 define <8 x float> @test_mask_xor_ps_rrkz_256(<8 x float> %a, <8 x float> %b, i8 %mask) {
1018   ;CHECK-LABEL: test_mask_xor_ps_rrkz_256
1019   ;CHECK: vxorps %ymm1, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x57,0xc1]
1020   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
1021   ret <8 x float> %res
1022 }
1023
1024 define <8 x float> @test_mask_xor_ps_rm_256(<8 x float> %a, <8 x float>* %ptr_b) {
1025   ;CHECK-LABEL: test_mask_xor_ps_rm_256
1026   ;CHECK: vxorps (%rdi), %ymm0, %ymm0    ## encoding: [0x62,0xf1,0x7c,0x28,0x57,0x07]
1027   %b = load <8 x float>, <8 x float>* %ptr_b
1028   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
1029   ret <8 x float> %res
1030 }
1031
1032 define <8 x float> @test_mask_xor_ps_rmk_256(<8 x float> %a, <8 x float>* %ptr_b, <8 x float> %passThru, i8 %mask) {
1033   ;CHECK-LABEL: test_mask_xor_ps_rmk_256
1034   ;CHECK: vxorps (%rdi), %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x29,0x57,0x0f]
1035   %b = load <8 x float>, <8 x float>* %ptr_b
1036   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
1037   ret <8 x float> %res
1038 }
1039
1040 define <8 x float> @test_mask_xor_ps_rmkz_256(<8 x float> %a, <8 x float>* %ptr_b, i8 %mask) {
1041   ;CHECK-LABEL: test_mask_xor_ps_rmkz_256
1042   ;CHECK: vxorps (%rdi), %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xa9,0x57,0x07]
1043   %b = load <8 x float>, <8 x float>* %ptr_b
1044   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
1045   ret <8 x float> %res
1046 }
1047
1048 define <8 x float> @test_mask_xor_ps_rmb_256(<8 x float> %a, float* %ptr_b) {
1049   ;CHECK-LABEL: test_mask_xor_ps_rmb_256
1050   ;CHECK: vxorps (%rdi){1to8}, %ymm0, %ymm0  ## encoding: [0x62,0xf1,0x7c,0x38,0x57,0x07]
1051   %q = load float, float* %ptr_b
1052   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
1053   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
1054   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 -1)
1055   ret <8 x float> %res
1056 }
1057
1058 define <8 x float> @test_mask_xor_ps_rmbk_256(<8 x float> %a, float* %ptr_b, <8 x float> %passThru, i8 %mask) {
1059   ;CHECK-LABEL: test_mask_xor_ps_rmbk_256
1060   ;CHECK: vxorps (%rdi){1to8}, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x39,0x57,0x0f]
1061   %q = load float, float* %ptr_b
1062   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
1063   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
1064   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %passThru, i8 %mask)
1065   ret <8 x float> %res
1066 }
1067
1068 define <8 x float> @test_mask_xor_ps_rmbkz_256(<8 x float> %a, float* %ptr_b, i8 %mask) {
1069   ;CHECK-LABEL: test_mask_xor_ps_rmbkz_256
1070   ;CHECK: vxorps (%rdi){1to8}, %ymm0, %ymm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xb9,0x57,0x07]
1071   %q = load float, float* %ptr_b
1072   %vecinit.i = insertelement <8 x float> undef, float %q, i32 0
1073   %b = shufflevector <8 x float> %vecinit.i, <8 x float> undef, <8 x i32> zeroinitializer
1074   %res = call <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> zeroinitializer, i8 %mask)
1075   ret <8 x float> %res
1076 }
1077
1078 declare <8 x float> @llvm.x86.avx512.mask.xor.ps.256(<8 x float>, <8 x float>, <8 x float>, i8)
1079
1080 define <16 x float> @test_mask_xor_ps_rr_512(<16 x float> %a, <16 x float> %b) {
1081   ;CHECK-LABEL: test_mask_xor_ps_rr_512
1082   ;CHECK: vxorps %zmm1, %zmm0, %zmm0     ## encoding: [0x62,0xf1,0x7c,0x48,0x57,0xc1]
1083   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
1084   ret <16 x float> %res
1085 }
1086
1087 define <16 x float> @test_mask_xor_ps_rrk_512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask) {
1088   ;CHECK-LABEL: test_mask_xor_ps_rrk_512
1089   ;CHECK: vxorps %zmm1, %zmm0, %zmm2 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x57,0xd1]
1090   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
1091   ret <16 x float> %res
1092 }
1093
1094 define <16 x float> @test_mask_xor_ps_rrkz_512(<16 x float> %a, <16 x float> %b, i16 %mask) {
1095   ;CHECK-LABEL: test_mask_xor_ps_rrkz_512
1096   ;CHECK: vxorps %zmm1, %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x57,0xc1]
1097   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
1098   ret <16 x float> %res
1099 }
1100
1101 define <16 x float> @test_mask_xor_ps_rm_512(<16 x float> %a, <16 x float>* %ptr_b) {
1102   ;CHECK-LABEL: test_mask_xor_ps_rm_512
1103   ;CHECK: vxorps (%rdi), %zmm0, %zmm0    ## encoding: [0x62,0xf1,0x7c,0x48,0x57,0x07]
1104   %b = load <16 x float>, <16 x float>* %ptr_b
1105   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
1106   ret <16 x float> %res
1107 }
1108
1109 define <16 x float> @test_mask_xor_ps_rmk_512(<16 x float> %a, <16 x float>* %ptr_b, <16 x float> %passThru, i16 %mask) {
1110   ;CHECK-LABEL: test_mask_xor_ps_rmk_512
1111   ;CHECK: vxorps (%rdi), %zmm0, %zmm1 {%k1} ## encoding: [0x62,0xf1,0x7c,0x49,0x57,0x0f]
1112   %b = load <16 x float>, <16 x float>* %ptr_b
1113   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
1114   ret <16 x float> %res
1115 }
1116
1117 define <16 x float> @test_mask_xor_ps_rmkz_512(<16 x float> %a, <16 x float>* %ptr_b, i16 %mask) {
1118   ;CHECK-LABEL: test_mask_xor_ps_rmkz_512
1119   ;CHECK: vxorps (%rdi), %zmm0, %zmm0 {%k1} {z} ## encoding: [0x62,0xf1,0x7c,0xc9,0x57,0x07]
1120   %b = load <16 x float>, <16 x float>* %ptr_b
1121   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
1122   ret <16 x float> %res
1123 }
1124
1125 define <16 x float> @test_mask_xor_ps_rmb_512(<16 x float> %a, float* %ptr_b) {
1126   ;CHECK-LABEL: test_mask_xor_ps_rmb_512
1127   ;CHECK: vxorps (%rdi){1to16}, %zmm0, %zmm0  ## encoding: [0x62,0xf1,0x7c,0x58,0x57,0x07]
1128   %q = load float, float* %ptr_b
1129   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
1130   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
1131   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 -1)
1132   ret <16 x float> %res
1133 }
1134
1135 define <16 x float> @test_mask_xor_ps_rmbk_512(<16 x float> %a, float* %ptr_b, <16 x float> %passThru, i16 %mask) {
1136   ;CHECK-LABEL: test_mask_xor_ps_rmbk_512
1137   ;CHECK: vxorps (%rdi){1to16}, %zmm0, %zmm1 {%k1} 
1138   %q = load float, float* %ptr_b
1139   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
1140   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
1141   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %passThru, i16 %mask)
1142   ret <16 x float> %res
1143 }
1144
1145 define <16 x float> @test_mask_xor_ps_rmbkz_512(<16 x float> %a, float* %ptr_b, i16 %mask) {
1146   ;CHECK-LABEL: test_mask_xor_ps_rmbkz_512
1147   ;CHECK: vxorps (%rdi){1to16}, %zmm0, %zmm0 {%k1} {z} 
1148   %q = load float, float* %ptr_b
1149   %vecinit.i = insertelement <16 x float> undef, float %q, i32 0
1150   %b = shufflevector <16 x float> %vecinit.i, <16 x float> undef, <16 x i32> zeroinitializer
1151   %res = call <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> zeroinitializer, i16 %mask)
1152   ret <16 x float> %res
1153 }
1154
1155 declare <16 x float> @llvm.x86.avx512.mask.xor.ps.512(<16 x float>, <16 x float>, <16 x float>, i16)
1156
1157 declare <2 x i64> @llvm.x86.avx512.mask.cvtpd2qq.128(<2 x double>, <2 x i64>, i8)
1158
1159 define <2 x i64>@test_int_x86_avx512_mask_cvt_pd2qq_128(<2 x double> %x0, <2 x i64> %x1, i8 %x2) {
1160 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_pd2qq_128:
1161 ; CHECK:       ## BB#0:
1162 ; CHECK-NEXT:    kmovb %edi, %k1
1163 ; CHECK-NEXT:    vcvtpd2qq %xmm0, %xmm1 {%k1}
1164 ; CHECK-NEXT:    vcvtpd2qq %xmm0, %xmm0
1165 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1166 ; CHECK-NEXT:    retq
1167   %res = call <2 x i64> @llvm.x86.avx512.mask.cvtpd2qq.128(<2 x double> %x0, <2 x i64> %x1, i8 %x2)
1168   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvtpd2qq.128(<2 x double> %x0, <2 x i64> %x1, i8 -1)
1169   %res2 = add <2 x i64> %res, %res1
1170   ret <2 x i64> %res2
1171 }
1172
1173 declare <4 x i64> @llvm.x86.avx512.mask.cvtpd2qq.256(<4 x double>, <4 x i64>, i8)
1174
1175 define <4 x i64>@test_int_x86_avx512_mask_cvt_pd2qq_256(<4 x double> %x0, <4 x i64> %x1, i8 %x2) {
1176 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_pd2qq_256:
1177 ; CHECK:       ## BB#0:
1178 ; CHECK-NEXT:    kmovb %edi, %k1
1179 ; CHECK-NEXT:    vcvtpd2qq %ymm0, %ymm1 {%k1}
1180 ; CHECK-NEXT:    vcvtpd2qq %ymm0, %ymm0
1181 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1182 ; CHECK-NEXT:    retq
1183   %res = call <4 x i64> @llvm.x86.avx512.mask.cvtpd2qq.256(<4 x double> %x0, <4 x i64> %x1, i8 %x2)
1184   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvtpd2qq.256(<4 x double> %x0, <4 x i64> %x1, i8 -1)
1185   %res2 = add <4 x i64> %res, %res1
1186   ret <4 x i64> %res2
1187 }
1188
1189 declare <2 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.128(<2 x double>, <2 x i64>, i8)
1190
1191 define <2 x i64>@test_int_x86_avx512_mask_cvt_pd2uqq_128(<2 x double> %x0, <2 x i64> %x1, i8 %x2) {
1192 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_pd2uqq_128:
1193 ; CHECK:       ## BB#0:
1194 ; CHECK-NEXT:    kmovb %edi, %k1
1195 ; CHECK-NEXT:    vcvtpd2uqq %xmm0, %xmm1 {%k1}
1196 ; CHECK-NEXT:    vcvtpd2uqq %xmm0, %xmm0
1197 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1198 ; CHECK-NEXT:    retq
1199   %res = call <2 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.128(<2 x double> %x0, <2 x i64> %x1, i8 %x2)
1200   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.128(<2 x double> %x0, <2 x i64> %x1, i8 -1)
1201   %res2 = add <2 x i64> %res, %res1
1202   ret <2 x i64> %res2
1203 }
1204
1205 declare <4 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.256(<4 x double>, <4 x i64>, i8)
1206
1207 define <4 x i64>@test_int_x86_avx512_mask_cvt_pd2uqq_256(<4 x double> %x0, <4 x i64> %x1, i8 %x2) {
1208 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_pd2uqq_256:
1209 ; CHECK:       ## BB#0:
1210 ; CHECK-NEXT:    kmovb %edi, %k1
1211 ; CHECK-NEXT:    vcvtpd2uqq %ymm0, %ymm1 {%k1}
1212 ; CHECK-NEXT:    vcvtpd2uqq %ymm0, %ymm0
1213 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1214 ; CHECK-NEXT:    retq
1215   %res = call <4 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.256(<4 x double> %x0, <4 x i64> %x1, i8 %x2)
1216   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvtpd2uqq.256(<4 x double> %x0, <4 x i64> %x1, i8 -1)
1217   %res2 = add <4 x i64> %res, %res1
1218   ret <4 x i64> %res2
1219 }
1220
1221 declare <2 x i64> @llvm.x86.avx512.mask.cvtps2qq.128(<4 x float>, <2 x i64>, i8)
1222
1223 define <2 x i64>@test_int_x86_avx512_mask_cvt_ps2qq_128(<4 x float> %x0, <2 x i64> %x1, i8 %x2) {
1224 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_ps2qq_128:
1225 ; CHECK:       ## BB#0:
1226 ; CHECK-NEXT:    kmovb %edi, %k1
1227 ; CHECK-NEXT:    vcvtps2qq %xmm0, %xmm1 {%k1}
1228 ; CHECK-NEXT:    vcvtps2qq %xmm0, %xmm0
1229 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1230 ; CHECK-NEXT:    retq
1231   %res = call <2 x i64> @llvm.x86.avx512.mask.cvtps2qq.128(<4 x float> %x0, <2 x i64> %x1, i8 %x2)
1232   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvtps2qq.128(<4 x float> %x0, <2 x i64> %x1, i8 -1)
1233   %res2 = add <2 x i64> %res, %res1
1234   ret <2 x i64> %res2
1235 }
1236
1237 declare <4 x i64> @llvm.x86.avx512.mask.cvtps2qq.256(<4 x float>, <4 x i64>, i8)
1238
1239 define <4 x i64>@test_int_x86_avx512_mask_cvt_ps2qq_256(<4 x float> %x0, <4 x i64> %x1, i8 %x2) {
1240 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_ps2qq_256:
1241 ; CHECK:       ## BB#0:
1242 ; CHECK-NEXT:    kmovb %edi, %k1
1243 ; CHECK-NEXT:    vcvtps2qq %xmm0, %ymm1 {%k1}
1244 ; CHECK-NEXT:    vcvtps2qq %xmm0, %ymm0
1245 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1246 ; CHECK-NEXT:    retq
1247   %res = call <4 x i64> @llvm.x86.avx512.mask.cvtps2qq.256(<4 x float> %x0, <4 x i64> %x1, i8 %x2)
1248   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvtps2qq.256(<4 x float> %x0, <4 x i64> %x1, i8 -1)
1249   %res2 = add <4 x i64> %res, %res1
1250   ret <4 x i64> %res2
1251 }
1252
1253 declare <2 x i64> @llvm.x86.avx512.mask.cvtps2uqq.128(<4 x float>, <2 x i64>, i8)
1254
1255 define <2 x i64>@test_int_x86_avx512_mask_cvt_ps2uqq_128(<4 x float> %x0, <2 x i64> %x1, i8 %x2) {
1256 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_ps2uqq_128:
1257 ; CHECK:       ## BB#0:
1258 ; CHECK-NEXT:    kmovb %edi, %k1
1259 ; CHECK-NEXT:    vcvtps2uqq %xmm0, %xmm1 {%k1}
1260 ; CHECK-NEXT:    vcvtps2uqq %xmm0, %xmm0
1261 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1262 ; CHECK-NEXT:    retq
1263   %res = call <2 x i64> @llvm.x86.avx512.mask.cvtps2uqq.128(<4 x float> %x0, <2 x i64> %x1, i8 %x2)
1264   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvtps2uqq.128(<4 x float> %x0, <2 x i64> %x1, i8 -1)
1265   %res2 = add <2 x i64> %res, %res1
1266   ret <2 x i64> %res2
1267 }
1268
1269 declare <4 x i64> @llvm.x86.avx512.mask.cvtps2uqq.256(<4 x float>, <4 x i64>, i8)
1270
1271 define <4 x i64>@test_int_x86_avx512_mask_cvt_ps2uqq_256(<4 x float> %x0, <4 x i64> %x1, i8 %x2) {
1272 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_ps2uqq_256:
1273 ; CHECK:       ## BB#0:
1274 ; CHECK-NEXT:    kmovb %edi, %k1
1275 ; CHECK-NEXT:    vcvtps2uqq %xmm0, %ymm1 {%k1}
1276 ; CHECK-NEXT:    vcvtps2uqq %xmm0, %ymm0
1277 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1278 ; CHECK-NEXT:    retq
1279   %res = call <4 x i64> @llvm.x86.avx512.mask.cvtps2uqq.256(<4 x float> %x0, <4 x i64> %x1, i8 %x2)
1280   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvtps2uqq.256(<4 x float> %x0, <4 x i64> %x1, i8 -1)
1281   %res2 = add <4 x i64> %res, %res1
1282   ret <4 x i64> %res2
1283 }
1284
1285 declare <2 x double> @llvm.x86.avx512.mask.cvtqq2pd.128(<2 x i64>, <2 x double>, i8)
1286
1287 define <2 x double>@test_int_x86_avx512_mask_cvt_qq2pd_128(<2 x i64> %x0, <2 x double> %x1, i8 %x2) {
1288 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_qq2pd_128:
1289 ; CHECK:       ## BB#0:
1290 ; CHECK-NEXT:    kmovb %edi, %k1
1291 ; CHECK-NEXT:    vcvtqq2pd %xmm0, %xmm1 {%k1}
1292 ; CHECK-NEXT:    vcvtqq2pd %xmm0, %xmm0
1293 ; CHECK-NEXT:    vaddpd %xmm0, %xmm1, %xmm0
1294 ; CHECK-NEXT:    retq
1295   %res = call <2 x double> @llvm.x86.avx512.mask.cvtqq2pd.128(<2 x i64> %x0, <2 x double> %x1, i8 %x2)
1296   %res1 = call <2 x double> @llvm.x86.avx512.mask.cvtqq2pd.128(<2 x i64> %x0, <2 x double> %x1, i8 -1)
1297   %res2 = fadd <2 x double> %res, %res1
1298   ret <2 x double> %res2
1299 }
1300
1301 declare <4 x double> @llvm.x86.avx512.mask.cvtqq2pd.256(<4 x i64>, <4 x double>, i8)
1302
1303 define <4 x double>@test_int_x86_avx512_mask_cvt_qq2pd_256(<4 x i64> %x0, <4 x double> %x1, i8 %x2) {
1304 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_qq2pd_256:
1305 ; CHECK:       ## BB#0:
1306 ; CHECK-NEXT:    kmovb %edi, %k1
1307 ; CHECK-NEXT:    vcvtqq2pd %ymm0, %ymm1 {%k1}
1308 ; CHECK-NEXT:    vcvtqq2pd %ymm0, %ymm0
1309 ; CHECK-NEXT:    vaddpd %ymm0, %ymm1, %ymm0
1310 ; CHECK-NEXT:    retq
1311   %res = call <4 x double> @llvm.x86.avx512.mask.cvtqq2pd.256(<4 x i64> %x0, <4 x double> %x1, i8 %x2)
1312   %res1 = call <4 x double> @llvm.x86.avx512.mask.cvtqq2pd.256(<4 x i64> %x0, <4 x double> %x1, i8 -1)
1313   %res2 = fadd <4 x double> %res, %res1
1314   ret <4 x double> %res2
1315 }
1316
1317 declare <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.128(<2 x i64>, <4 x float>, i8)
1318
1319 define <4 x float>@test_int_x86_avx512_mask_cvt_qq2ps_128(<2 x i64> %x0, <4 x float> %x1, i8 %x2) {
1320 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_qq2ps_128:
1321 ; CHECK:       ## BB#0:
1322 ; CHECK-NEXT:    kmovb %edi, %k1
1323 ; CHECK-NEXT:    vcvtqq2ps %xmm0, %xmm1 {%k1}
1324 ; CHECK-NEXT:    vcvtqq2ps %xmm0, %xmm0
1325 ; CHECK-NEXT:    vaddps %xmm0, %xmm1, %xmm0
1326 ; CHECK-NEXT:    retq
1327   %res = call <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.128(<2 x i64> %x0, <4 x float> %x1, i8 %x2)
1328   %res1 = call <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.128(<2 x i64> %x0, <4 x float> %x1, i8 -1)
1329   %res2 = fadd <4 x float> %res, %res1
1330   ret <4 x float> %res2
1331 }
1332
1333 declare <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.256(<4 x i64>, <4 x float>, i8)
1334
1335 define <4 x float>@test_int_x86_avx512_mask_cvt_qq2ps_256(<4 x i64> %x0, <4 x float> %x1, i8 %x2) {
1336 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_qq2ps_256:
1337 ; CHECK:       ## BB#0:
1338 ; CHECK-NEXT:    kmovb %edi, %k1
1339 ; CHECK-NEXT:    vcvtqq2ps %ymm0, %xmm1 {%k1}
1340 ; CHECK-NEXT:    vcvtqq2ps %ymm0, %xmm0
1341 ; CHECK-NEXT:    vaddps %xmm0, %xmm1, %xmm0
1342 ; CHECK-NEXT:    retq
1343   %res = call <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.256(<4 x i64> %x0, <4 x float> %x1, i8 %x2)
1344   %res1 = call <4 x float> @llvm.x86.avx512.mask.cvtqq2ps.256(<4 x i64> %x0, <4 x float> %x1, i8 -1)
1345   %res2 = fadd <4 x float> %res, %res1
1346   ret <4 x float> %res2
1347 }
1348
1349 declare <2 x i64> @llvm.x86.avx512.mask.cvttpd2qq.128(<2 x double>, <2 x i64>, i8)
1350
1351 define <2 x i64>@test_int_x86_avx512_mask_cvtt_pd2qq_128(<2 x double> %x0, <2 x i64> %x1, i8 %x2) {
1352 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_pd2qq_128:
1353 ; CHECK:       ## BB#0:
1354 ; CHECK-NEXT:    kmovb %edi, %k1
1355 ; CHECK-NEXT:    vcvttpd2qq %xmm0, %xmm1 {%k1}
1356 ; CHECK-NEXT:    vcvttpd2qq %xmm0, %xmm0
1357 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1358 ; CHECK-NEXT:    retq
1359   %res = call <2 x i64> @llvm.x86.avx512.mask.cvttpd2qq.128(<2 x double> %x0, <2 x i64> %x1, i8 %x2)
1360   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvttpd2qq.128(<2 x double> %x0, <2 x i64> %x1, i8 -1)
1361   %res2 = add <2 x i64> %res, %res1
1362   ret <2 x i64> %res2
1363 }
1364
1365 declare <4 x i64> @llvm.x86.avx512.mask.cvttpd2qq.256(<4 x double>, <4 x i64>, i8)
1366
1367 define <4 x i64>@test_int_x86_avx512_mask_cvtt_pd2qq_256(<4 x double> %x0, <4 x i64> %x1, i8 %x2) {
1368 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_pd2qq_256:
1369 ; CHECK:       ## BB#0:
1370 ; CHECK-NEXT:    kmovb %edi, %k1
1371 ; CHECK-NEXT:    vcvttpd2qq %ymm0, %ymm1 {%k1}
1372 ; CHECK-NEXT:    vcvttpd2qq %ymm0, %ymm0
1373 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1374 ; CHECK-NEXT:    retq
1375   %res = call <4 x i64> @llvm.x86.avx512.mask.cvttpd2qq.256(<4 x double> %x0, <4 x i64> %x1, i8 %x2)
1376   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvttpd2qq.256(<4 x double> %x0, <4 x i64> %x1, i8 -1)
1377   %res2 = add <4 x i64> %res, %res1
1378   ret <4 x i64> %res2
1379 }
1380
1381 declare <2 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.128(<2 x double>, <2 x i64>, i8)
1382
1383 define <2 x i64>@test_int_x86_avx512_mask_cvtt_pd2uqq_128(<2 x double> %x0, <2 x i64> %x1, i8 %x2) {
1384 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_pd2uqq_128:
1385 ; CHECK:       ## BB#0:
1386 ; CHECK-NEXT:    kmovb %edi, %k1
1387 ; CHECK-NEXT:    vcvttpd2uqq %xmm0, %xmm1 {%k1}
1388 ; CHECK-NEXT:    vcvttpd2uqq %xmm0, %xmm0
1389 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1390 ; CHECK-NEXT:    retq
1391   %res = call <2 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.128(<2 x double> %x0, <2 x i64> %x1, i8 %x2)
1392   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.128(<2 x double> %x0, <2 x i64> %x1, i8 -1)
1393   %res2 = add <2 x i64> %res, %res1
1394   ret <2 x i64> %res2
1395 }
1396
1397 declare <4 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.256(<4 x double>, <4 x i64>, i8)
1398
1399 define <4 x i64>@test_int_x86_avx512_mask_cvtt_pd2uqq_256(<4 x double> %x0, <4 x i64> %x1, i8 %x2) {
1400 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_pd2uqq_256:
1401 ; CHECK:       ## BB#0:
1402 ; CHECK-NEXT:    kmovb %edi, %k1
1403 ; CHECK-NEXT:    vcvttpd2uqq %ymm0, %ymm1 {%k1}
1404 ; CHECK-NEXT:    vcvttpd2uqq %ymm0, %ymm0
1405 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1406 ; CHECK-NEXT:    retq
1407   %res = call <4 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.256(<4 x double> %x0, <4 x i64> %x1, i8 %x2)
1408   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvttpd2uqq.256(<4 x double> %x0, <4 x i64> %x1, i8 -1)
1409   %res2 = add <4 x i64> %res, %res1
1410   ret <4 x i64> %res2
1411 }
1412
1413 declare <2 x i64> @llvm.x86.avx512.mask.cvttps2qq.128(<4 x float>, <2 x i64>, i8)
1414
1415 define <2 x i64>@test_int_x86_avx512_mask_cvtt_ps2qq_128(<4 x float> %x0, <2 x i64> %x1, i8 %x2) {
1416 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_ps2qq_128:
1417 ; CHECK:       ## BB#0:
1418 ; CHECK-NEXT:    kmovb %edi, %k1
1419 ; CHECK-NEXT:    vcvttps2qq %xmm0, %xmm1 {%k1}
1420 ; CHECK-NEXT:    vcvttps2qq %xmm0, %xmm0
1421 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1422 ; CHECK-NEXT:    retq
1423   %res = call <2 x i64> @llvm.x86.avx512.mask.cvttps2qq.128(<4 x float> %x0, <2 x i64> %x1, i8 %x2)
1424   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvttps2qq.128(<4 x float> %x0, <2 x i64> %x1, i8 -1)
1425   %res2 = add <2 x i64> %res, %res1
1426   ret <2 x i64> %res2
1427 }
1428
1429 declare <4 x i64> @llvm.x86.avx512.mask.cvttps2qq.256(<4 x float>, <4 x i64>, i8)
1430
1431 define <4 x i64>@test_int_x86_avx512_mask_cvtt_ps2qq_256(<4 x float> %x0, <4 x i64> %x1, i8 %x2) {
1432 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_ps2qq_256:
1433 ; CHECK:       ## BB#0:
1434 ; CHECK-NEXT:    kmovb %edi, %k1
1435 ; CHECK-NEXT:    vcvttps2qq %xmm0, %ymm1 {%k1}
1436 ; CHECK-NEXT:    vcvttps2qq %xmm0, %ymm0
1437 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1438 ; CHECK-NEXT:    retq
1439   %res = call <4 x i64> @llvm.x86.avx512.mask.cvttps2qq.256(<4 x float> %x0, <4 x i64> %x1, i8 %x2)
1440   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvttps2qq.256(<4 x float> %x0, <4 x i64> %x1, i8 -1)
1441   %res2 = add <4 x i64> %res, %res1
1442   ret <4 x i64> %res2
1443 }
1444
1445 declare <2 x double> @llvm.x86.avx512.mask.cvtuqq2pd.128(<2 x i64>, <2 x double>, i8)
1446
1447 define <2 x double>@test_int_x86_avx512_mask_cvt_uqq2pd_128(<2 x i64> %x0, <2 x double> %x1, i8 %x2) {
1448 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_uqq2pd_128:
1449 ; CHECK:       ## BB#0:
1450 ; CHECK-NEXT:    kmovb %edi, %k1
1451 ; CHECK-NEXT:    vcvtuqq2pd %xmm0, %xmm1 {%k1}
1452 ; CHECK-NEXT:    vcvtuqq2pd %xmm0, %xmm0
1453 ; CHECK-NEXT:    vaddpd %xmm0, %xmm1, %xmm0
1454 ; CHECK-NEXT:    retq
1455   %res = call <2 x double> @llvm.x86.avx512.mask.cvtuqq2pd.128(<2 x i64> %x0, <2 x double> %x1, i8 %x2)
1456   %res1 = call <2 x double> @llvm.x86.avx512.mask.cvtuqq2pd.128(<2 x i64> %x0, <2 x double> %x1, i8 -1)
1457   %res2 = fadd <2 x double> %res, %res1
1458   ret <2 x double> %res2
1459 }
1460
1461 declare <4 x double> @llvm.x86.avx512.mask.cvtuqq2pd.256(<4 x i64>, <4 x double>, i8)
1462
1463 define <4 x double>@test_int_x86_avx512_mask_cvt_uqq2pd_256(<4 x i64> %x0, <4 x double> %x1, i8 %x2) {
1464 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_uqq2pd_256:
1465 ; CHECK:       ## BB#0:
1466 ; CHECK-NEXT:    kmovb %edi, %k1
1467 ; CHECK-NEXT:    vcvtuqq2pd %ymm0, %ymm1 {%k1}
1468 ; CHECK-NEXT:    vcvtuqq2pd %ymm0, %ymm0
1469 ; CHECK-NEXT:    vaddpd %ymm0, %ymm1, %ymm0
1470 ; CHECK-NEXT:    retq
1471   %res = call <4 x double> @llvm.x86.avx512.mask.cvtuqq2pd.256(<4 x i64> %x0, <4 x double> %x1, i8 %x2)
1472   %res1 = call <4 x double> @llvm.x86.avx512.mask.cvtuqq2pd.256(<4 x i64> %x0, <4 x double> %x1, i8 -1)
1473   %res2 = fadd <4 x double> %res, %res1
1474   ret <4 x double> %res2
1475 }
1476
1477 declare <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.128(<2 x i64>, <4 x float>, i8)
1478
1479 define <4 x float>@test_int_x86_avx512_mask_cvt_uqq2ps_128(<2 x i64> %x0, <4 x float> %x1, i8 %x2) {
1480 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_uqq2ps_128:
1481 ; CHECK:       ## BB#0:
1482 ; CHECK-NEXT:    kmovb %edi, %k1
1483 ; CHECK-NEXT:    vcvtuqq2ps %xmm0, %xmm1 {%k1}
1484 ; CHECK-NEXT:    vcvtuqq2ps %xmm0, %xmm0
1485 ; CHECK-NEXT:    vaddps %xmm0, %xmm1, %xmm0
1486 ; CHECK-NEXT:    retq
1487   %res = call <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.128(<2 x i64> %x0, <4 x float> %x1, i8 %x2)
1488   %res1 = call <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.128(<2 x i64> %x0, <4 x float> %x1, i8 -1)
1489   %res2 = fadd <4 x float> %res, %res1
1490   ret <4 x float> %res2
1491 }
1492
1493 declare <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.256(<4 x i64>, <4 x float>, i8)
1494
1495 define <4 x float>@test_int_x86_avx512_mask_cvt_uqq2ps_256(<4 x i64> %x0, <4 x float> %x1, i8 %x2) {
1496 ; CHECK-LABEL: test_int_x86_avx512_mask_cvt_uqq2ps_256:
1497 ; CHECK:       ## BB#0:
1498 ; CHECK-NEXT:    kmovb %edi, %k1
1499 ; CHECK-NEXT:    vcvtuqq2ps %ymm0, %xmm1 {%k1}
1500 ; CHECK-NEXT:    vcvtuqq2ps %ymm0, %xmm0
1501 ; CHECK-NEXT:    vaddps %xmm0, %xmm1, %xmm0
1502 ; CHECK-NEXT:    retq
1503   %res = call <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.256(<4 x i64> %x0, <4 x float> %x1, i8 %x2)
1504   %res1 = call <4 x float> @llvm.x86.avx512.mask.cvtuqq2ps.256(<4 x i64> %x0, <4 x float> %x1, i8 -1)
1505   %res2 = fadd <4 x float> %res, %res1
1506   ret <4 x float> %res2
1507 }
1508
1509 declare <2 x i64> @llvm.x86.avx512.mask.cvttps2uqq.128(<4 x float>, <2 x i64>, i8)
1510
1511 define <2 x i64>@test_int_x86_avx512_mask_cvtt_ps2uqq_128(<4 x float> %x0, <2 x i64> %x1, i8 %x2) {
1512 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_ps2uqq_128:
1513 ; CHECK:       ## BB#0:
1514 ; CHECK-NEXT:    kmovb %edi, %k1
1515 ; CHECK-NEXT:    vcvttps2uqq %xmm0, %xmm1 {%k1}
1516 ; CHECK-NEXT:    vcvttps2uqq %xmm0, %xmm0
1517 ; CHECK-NEXT:    vpaddq %xmm0, %xmm1, %xmm0
1518 ; CHECK-NEXT:    retq
1519   %res = call <2 x i64> @llvm.x86.avx512.mask.cvttps2uqq.128(<4 x float> %x0, <2 x i64> %x1, i8 %x2)
1520   %res1 = call <2 x i64> @llvm.x86.avx512.mask.cvttps2uqq.128(<4 x float> %x0, <2 x i64> %x1, i8 -1)
1521   %res2 = add <2 x i64> %res, %res1
1522   ret <2 x i64> %res2
1523 }
1524
1525 declare <4 x i64> @llvm.x86.avx512.mask.cvttps2uqq.256(<4 x float>, <4 x i64>, i8)
1526
1527 define <4 x i64>@test_int_x86_avx512_mask_cvtt_ps2uqq_256(<4 x float> %x0, <4 x i64> %x1, i8 %x2) {
1528 ; CHECK-LABEL: test_int_x86_avx512_mask_cvtt_ps2uqq_256:
1529 ; CHECK:       ## BB#0:
1530 ; CHECK-NEXT:    kmovb %edi, %k1
1531 ; CHECK-NEXT:    vcvttps2uqq %xmm0, %ymm1 {%k1}
1532 ; CHECK-NEXT:    vcvttps2uqq %xmm0, %ymm0
1533 ; CHECK-NEXT:    vpaddq %ymm0, %ymm1, %ymm0
1534 ; CHECK-NEXT:    retq
1535   %res = call <4 x i64> @llvm.x86.avx512.mask.cvttps2uqq.256(<4 x float> %x0, <4 x i64> %x1, i8 %x2)
1536   %res1 = call <4 x i64> @llvm.x86.avx512.mask.cvttps2uqq.256(<4 x float> %x0, <4 x i64> %x1, i8 -1)
1537   %res2 = add <4 x i64> %res, %res1
1538   ret <4 x i64> %res2
1539 }
1540
1541 declare <2 x double> @llvm.x86.avx512.mask.reduce.pd.128(<2 x double>, i32, <2 x double>, i8)
1542
1543 ; CHECK-LABEL: @test_int_x86_avx512_mask_reduce_pd_128
1544 ; CHECK-NOT: call 
1545 ; CHECK: kmov 
1546 ; CHECK: vreducepd {{.*}}{%k1} 
1547 ; CHECK: vreducepd
1548 define <2 x double>@test_int_x86_avx512_mask_reduce_pd_128(<2 x double> %x0, <2 x double> %x2, i8 %x3) {
1549   %res = call <2 x double> @llvm.x86.avx512.mask.reduce.pd.128(<2 x double> %x0, i32 4, <2 x double> %x2, i8 %x3)
1550   %res1 = call <2 x double> @llvm.x86.avx512.mask.reduce.pd.128(<2 x double> %x0, i32 8, <2 x double> %x2, i8 -1)
1551   %res2 = fadd <2 x double> %res, %res1
1552   ret <2 x double> %res2
1553 }
1554
1555 declare <4 x double> @llvm.x86.avx512.mask.reduce.pd.256(<4 x double>, i32, <4 x double>, i8)
1556
1557 ; CHECK-LABEL: @test_int_x86_avx512_mask_reduce_pd_256
1558 ; CHECK-NOT: call 
1559 ; CHECK: kmov 
1560 ; CHECK: vreducepd {{.*}}{%k1} 
1561 ; CHECK: vreducepd
1562 define <4 x double>@test_int_x86_avx512_mask_reduce_pd_256(<4 x double> %x0, <4 x double> %x2, i8 %x3) {
1563   %res = call <4 x double> @llvm.x86.avx512.mask.reduce.pd.256(<4 x double> %x0, i32 4, <4 x double> %x2, i8 %x3)
1564   %res1 = call <4 x double> @llvm.x86.avx512.mask.reduce.pd.256(<4 x double> %x0, i32 0, <4 x double> %x2, i8 -1)
1565   %res2 = fadd <4 x double> %res, %res1
1566   ret <4 x double> %res2
1567 }
1568
1569 declare <4 x float> @llvm.x86.avx512.mask.reduce.ps.128(<4 x float>, i32, <4 x float>, i8)
1570 ; CHECK-LABEL: @test_int_x86_avx512_mask_reduce_ps_128
1571 ; CHECK-NOT: call 
1572 ; CHECK: kmov 
1573 ; CHECK: vreduceps {{.*}}{%k1} 
1574 ; CHECK: vreduceps
1575 define <4 x float>@test_int_x86_avx512_mask_reduce_ps_128(<4 x float> %x0, <4 x float> %x2, i8 %x3) {
1576   %res = call <4 x float> @llvm.x86.avx512.mask.reduce.ps.128(<4 x float> %x0, i32 4, <4 x float> %x2, i8 %x3)
1577   %res1 = call <4 x float> @llvm.x86.avx512.mask.reduce.ps.128(<4 x float> %x0, i32 88, <4 x float> %x2, i8 -1)
1578   %res2 = fadd <4 x float> %res, %res1
1579   ret <4 x float> %res2
1580 }
1581
1582 declare <8 x float> @llvm.x86.avx512.mask.reduce.ps.256(<8 x float>, i32, <8 x float>, i8)
1583
1584 ; CHECK-LABEL: @test_int_x86_avx512_mask_reduce_ps_256
1585 ; CHECK-NOT: call 
1586 ; CHECK: kmov 
1587 ; CHECK: vreduceps {{.*}}{%k1} 
1588 ; CHECK: vreduceps
1589 define <8 x float>@test_int_x86_avx512_mask_reduce_ps_256(<8 x float> %x0, <8 x float> %x2, i8 %x3) {
1590   %res = call <8 x float> @llvm.x86.avx512.mask.reduce.ps.256(<8 x float> %x0, i32 11, <8 x float> %x2, i8 %x3)
1591   %res1 = call <8 x float> @llvm.x86.avx512.mask.reduce.ps.256(<8 x float> %x0, i32 11, <8 x float> %x2, i8 -1)
1592   %res2 = fadd <8 x float> %res, %res1
1593   ret <8 x float> %res2
1594 }
1595
1596 declare <2 x double> @llvm.x86.avx512.mask.range.pd.128(<2 x double>, <2 x double>, i32, <2 x double>, i8)
1597
1598 ; CHECK-LABEL: @test_int_x86_avx512_mask_range_pd_128
1599 ; CHECK-NOT: call 
1600 ; CHECK: kmov 
1601 ; CHECK: vrangepd {{.*}}{%k1} 
1602 ; CHECK: vrangepd
1603 define <2 x double>@test_int_x86_avx512_mask_range_pd_128(<2 x double> %x0, <2 x double> %x1, <2 x double> %x3, i8 %x4) {
1604   %res = call <2 x double> @llvm.x86.avx512.mask.range.pd.128(<2 x double> %x0, <2 x double> %x1, i32 4, <2 x double> %x3, i8 %x4)
1605   %res1 = call <2 x double> @llvm.x86.avx512.mask.range.pd.128(<2 x double> %x0, <2 x double> %x1, i32 8, <2 x double> %x3, i8 -1)
1606   %res2 = fadd <2 x double> %res, %res1
1607   ret <2 x double> %res2
1608 }
1609
1610 declare <4 x double> @llvm.x86.avx512.mask.range.pd.256(<4 x double>, <4 x double>, i32, <4 x double>, i8)
1611
1612 ; CHECK-LABEL: @test_int_x86_avx512_mask_range_pd_256
1613 ; CHECK-NOT: call 
1614 ; CHECK: kmov 
1615 ; CHECK: vrangepd {{.*}}{%k1} 
1616 ; CHECK: vrangepd
1617 define <4 x double>@test_int_x86_avx512_mask_range_pd_256(<4 x double> %x0, <4 x double> %x1, <4 x double> %x3, i8 %x4) {
1618   %res = call <4 x double> @llvm.x86.avx512.mask.range.pd.256(<4 x double> %x0, <4 x double> %x1, i32 4, <4 x double> %x3, i8 %x4)
1619   %res1 = call <4 x double> @llvm.x86.avx512.mask.range.pd.256(<4 x double> %x0, <4 x double> %x1, i32 88, <4 x double> %x3, i8 -1)
1620   %res2 = fadd <4 x double> %res, %res1
1621   ret <4 x double> %res2
1622 }
1623
1624 declare <4 x float> @llvm.x86.avx512.mask.range.ps.128(<4 x float>, <4 x float>, i32, <4 x float>, i8)
1625
1626 ; CHECK-LABEL: @test_int_x86_avx512_mask_range_ps_128
1627 ; CHECK-NOT: call 
1628 ; CHECK: kmov 
1629 ; CHECK: vrangeps {{.*}}{%k1} 
1630 ; CHECK: vrangeps
1631 define <4 x float>@test_int_x86_avx512_mask_range_ps_128(<4 x float> %x0, <4 x float> %x1, <4 x float> %x3, i8 %x4) {
1632   %res = call <4 x float> @llvm.x86.avx512.mask.range.ps.128(<4 x float> %x0, <4 x float> %x1, i32 4, <4 x float> %x3, i8 %x4)
1633   %res1 = call <4 x float> @llvm.x86.avx512.mask.range.ps.128(<4 x float> %x0, <4 x float> %x1, i32 88, <4 x float> %x3, i8 -1)
1634   %res2 = fadd <4 x float> %res, %res1
1635   ret <4 x float> %res2
1636 }
1637
1638 declare <8 x float> @llvm.x86.avx512.mask.range.ps.256(<8 x float>, <8 x float>, i32, <8 x float>, i8)
1639
1640 ; CHECK-LABEL: @test_int_x86_avx512_mask_range_ps_256
1641 ; CHECK-NOT: call 
1642 ; CHECK: kmov 
1643 ; CHECK: vrangeps {{.*}}{%k1} 
1644 ; CHECK: vrangeps
1645 define <8 x float>@test_int_x86_avx512_mask_range_ps_256(<8 x float> %x0, <8 x float> %x1, <8 x float> %x3, i8 %x4) {
1646   %res = call <8 x float> @llvm.x86.avx512.mask.range.ps.256(<8 x float> %x0, <8 x float> %x1, i32 4, <8 x float> %x3, i8 %x4)
1647   %res1 = call <8 x float> @llvm.x86.avx512.mask.range.ps.256(<8 x float> %x0, <8 x float> %x1, i32 88, <8 x float> %x3, i8 -1)
1648   %res2 = fadd <8 x float> %res, %res1
1649   ret <8 x float> %res2
1650 }
1651
1652 declare <2 x double> @llvm.x86.avx512.mask.vextractf64x2.256(<4 x double>, i32, <2 x double>, i8)
1653
1654 define <2 x double>@test_int_x86_avx512_mask_vextractf64x2_256(<4 x double> %x0, <2 x double> %x2, i8 %x3) {
1655 ; CHECK-LABEL: test_int_x86_avx512_mask_vextractf64x2_256:
1656 ; CHECK:       ## BB#0:
1657 ; CHECK-NEXT:    kmovb %edi, %k1
1658 ; CHECK-NEXT:    vextractf64x2 $1, %ymm0, %xmm1 {%k1}
1659 ; CHECK-NEXT:    vextractf64x2 $1, %ymm0, %xmm2 {%k1} {z}
1660 ; CHECK-NEXT:    vextractf64x2 $1, %ymm0, %xmm0
1661 ; CHECK-NEXT:    vaddpd %xmm0, %xmm1, %xmm0
1662 ; CHECK-NEXT:    vaddpd %xmm2, %xmm0, %xmm0
1663 ; CHECK-NEXT:    retq
1664   %res = call <2 x double> @llvm.x86.avx512.mask.vextractf64x2.256(<4 x double> %x0,i32 1, <2 x double> %x2, i8 %x3)
1665   %res2 = call <2 x double> @llvm.x86.avx512.mask.vextractf64x2.256(<4 x double> %x0,i32 1, <2 x double> zeroinitializer, i8 %x3)
1666   %res1 = call <2 x double> @llvm.x86.avx512.mask.vextractf64x2.256(<4 x double> %x0,i32 1, <2 x double> zeroinitializer, i8 -1)
1667   %res3 = fadd <2 x double> %res, %res1
1668   %res4 = fadd <2 x double> %res3, %res2
1669   ret <2 x double> %res4
1670 }
1671
1672 declare <4 x double> @llvm.x86.avx512.mask.insertf64x2.256(<4 x double>, <2 x double>, i32, <4 x double>, i8)
1673
1674 define <4 x double>@test_int_x86_avx512_mask_insertf64x2_256(<4 x double> %x0, <2 x double> %x1, <4 x double> %x3, i8 %x4) {
1675 ; CHECK-LABEL: test_int_x86_avx512_mask_insertf64x2_256:
1676 ; CHECK:       ## BB#0:
1677 ; CHECK-NEXT:    kmovb %edi, %k1
1678 ; CHECK-NEXT:    vinsertf64x2 $1, %xmm1, %ymm0, %ymm2 {%k1}
1679 ; CHECK-NEXT:    vinsertf64x2 $1, %xmm1, %ymm0, %ymm3 {%k1} {z}
1680 ; CHECK-NEXT:    vinsertf64x2 $1, %xmm1, %ymm0, %ymm0
1681 ; CHECK-NEXT:    vaddpd %ymm0, %ymm2, %ymm0
1682 ; CHECK-NEXT:    vaddpd %ymm0, %ymm3, %ymm0
1683 ; CHECK-NEXT:    retq
1684   %res = call <4 x double> @llvm.x86.avx512.mask.insertf64x2.256(<4 x double> %x0, <2 x double> %x1, i32 1, <4 x double> %x3, i8 %x4)
1685   %res1 = call <4 x double> @llvm.x86.avx512.mask.insertf64x2.256(<4 x double> %x0, <2 x double> %x1, i32 1, <4 x double> %x3, i8 -1)
1686   %res2 = call <4 x double> @llvm.x86.avx512.mask.insertf64x2.256(<4 x double> %x0, <2 x double> %x1, i32 1, <4 x double> zeroinitializer, i8 %x4)
1687   %res3 = fadd <4 x double> %res, %res1
1688   %res4 = fadd <4 x double> %res2, %res3
1689   ret <4 x double> %res4
1690 }
1691
1692 declare <4 x i64> @llvm.x86.avx512.mask.inserti64x2.256(<4 x i64>, <2 x i64>, i32, <4 x i64>, i8)
1693
1694 define <4 x i64>@test_int_x86_avx512_mask_inserti64x2_256(<4 x i64> %x0, <2 x i64> %x1, <4 x i64> %x3, i8 %x4) {
1695 ; CHECK-LABEL: test_int_x86_avx512_mask_inserti64x2_256:
1696 ; CHECK:       ## BB#0:
1697 ; CHECK-NEXT:    kmovb %edi, %k1
1698 ; CHECK-NEXT:    vinserti64x2 $1, %xmm1, %ymm0, %ymm2 {%k1}
1699 ; CHECK-NEXT:    vinserti64x2 $1, %xmm1, %ymm0, %ymm3 {%k1} {z}
1700 ; CHECK-NEXT:    vinserti64x2 $1, %xmm1, %ymm0, %ymm0
1701 ; CHECK-NEXT:    vpaddq %ymm0, %ymm2, %ymm0
1702 ; CHECK-NEXT:    vpaddq %ymm3, %ymm0, %ymm0
1703 ; CHECK-NEXT:    retq
1704   %res = call <4 x i64> @llvm.x86.avx512.mask.inserti64x2.256(<4 x i64> %x0, <2 x i64> %x1, i32 1, <4 x i64> %x3, i8 %x4)
1705   %res1 = call <4 x i64> @llvm.x86.avx512.mask.inserti64x2.256(<4 x i64> %x0, <2 x i64> %x1, i32 1, <4 x i64> %x3, i8 -1)
1706   %res2 = call <4 x i64> @llvm.x86.avx512.mask.inserti64x2.256(<4 x i64> %x0, <2 x i64> %x1, i32 1, <4 x i64> zeroinitializer, i8 %x4)
1707   %res3 = add <4 x i64> %res, %res1
1708   %res4 = add <4 x i64> %res3, %res2
1709   ret <4 x i64> %res4
1710 }
1711
1712 declare i8 @llvm.x86.avx512.mask.fpclass.ps.128(<4 x float>, i32, i8)
1713
1714 ; CHECK-LABEL: @test_int_x86_avx512_mask_fpclass_ps_128
1715 ; CHECK-NOT: call 
1716 ; CHECK: kmov 
1717 ; CHECK: vfpclassps
1718 ; CHECK: {%k1} 
1719 ; CHECK: vfpclassps
1720 ; CHECK: kmovb   %k0
1721 define i8 @test_int_x86_avx512_mask_fpclass_ps_128(<4 x float> %x0, i8 %x1) {
1722   %res = call i8 @llvm.x86.avx512.mask.fpclass.ps.128(<4 x float> %x0, i32 2, i8 %x1)
1723   %res1 = call i8 @llvm.x86.avx512.mask.fpclass.ps.128(<4 x float> %x0, i32 4, i8 -1)
1724   %res2 = add i8 %res, %res1
1725   ret i8 %res2
1726 }
1727
1728 declare i8 @llvm.x86.avx512.mask.fpclass.ps.256(<8 x float>, i32, i8)
1729
1730 ; CHECK-LABEL: @test_int_x86_avx512_mask_fpclass_ps_256
1731 ; CHECK-NOT: call 
1732 ; CHECK: kmov 
1733 ; CHECK: vfpclassps
1734 ; CHECK: {%k1} 
1735 ; CHECK: vfpclassps
1736 ; CHECK: kmovb   %k0
1737 define i8 @test_int_x86_avx512_mask_fpclass_ps_256(<8 x float> %x0, i8 %x1) {
1738   %res = call i8 @llvm.x86.avx512.mask.fpclass.ps.256(<8 x float> %x0, i32 2, i8 %x1)
1739   %res1 = call i8 @llvm.x86.avx512.mask.fpclass.ps.256(<8 x float> %x0, i32 4, i8 -1)
1740   %res2 = add i8 %res, %res1
1741   ret i8 %res2
1742 }
1743
1744 declare i8 @llvm.x86.avx512.mask.fpclass.pd.128(<2 x double>, i32, i8)
1745
1746 ; CHECK-LABEL: @test_int_x86_avx512_mask_fpclass_pd_128
1747 ; CHECK-NOT: call 
1748 ; CHECK: kmov 
1749 ; CHECK: vfpclasspd
1750 ; CHECK: {%k1} 
1751 ; CHECK: vfpclasspd
1752 ; CHECK: kmovb   %k0
1753 define i8 @test_int_x86_avx512_mask_fpclass_pd_128(<2 x double> %x0, i8 %x1) {
1754   %res =  call i8 @llvm.x86.avx512.mask.fpclass.pd.128(<2 x double> %x0, i32 4, i8 %x1)
1755   %res1 = call i8 @llvm.x86.avx512.mask.fpclass.pd.128(<2 x double> %x0, i32 2, i8 -1)
1756   %res2 = add i8 %res, %res1
1757   ret i8 %res2
1758 }
1759
1760 declare i8 @llvm.x86.avx512.mask.fpclass.pd.256(<4 x double>, i32, i8)
1761
1762 ; CHECK-LABEL: @test_int_x86_avx512_mask_fpclass_pd_256
1763 ; CHECK-NOT: call 
1764 ; CHECK: kmov 
1765 ; CHECK: vfpclasspd
1766 ; CHECK: {%k1} 
1767 ; CHECK: vfpclasspd
1768 ; CHECK: kmovb   %k0
1769 define i8 @test_int_x86_avx512_mask_fpclass_pd_256(<4 x double> %x0, i8 %x1) {
1770   %res = call i8 @llvm.x86.avx512.mask.fpclass.pd.256(<4 x double> %x0, i32 2, i8 %x1)
1771   %res1 = call i8 @llvm.x86.avx512.mask.fpclass.pd.256(<4 x double> %x0, i32 4, i8 -1)
1772   %res2 = add i8 %res, %res1
1773   ret i8 %res2
1774 }
1775
1776 declare <8 x float> @llvm.x86.avx512.mask.broadcastf32x2.256(<4 x float>, <8 x float>, i8)
1777
1778 define <8 x float>@test_int_x86_avx512_mask_broadcastf32x2_256(<4 x float> %x0, <8 x float> %x2, i8 %x3) {
1779 ; CHECK-LABEL: test_int_x86_avx512_mask_broadcastf32x2_256:
1780 ; CHECK:       ## BB#0:
1781 ; CHECK-NEXT:    kmovb %edi, %k1
1782 ; CHECK-NEXT:    vbroadcastf32x2 %xmm0, %ymm1 {%k1}
1783 ; CHECK-NEXT:    vbroadcastf32x2 %xmm0, %ymm2 {%k1} {z}
1784 ; CHECK-NEXT:    vbroadcastf32x2 %xmm0, %ymm0
1785 ; CHECK-NEXT:    vaddps %ymm2, %ymm1, %ymm1
1786 ; CHECK-NEXT:    vaddps %ymm0, %ymm1, %ymm0
1787 ; CHECK-NEXT:    retq
1788   %res = call <8 x float> @llvm.x86.avx512.mask.broadcastf32x2.256(<4 x float>  %x0, <8 x float> %x2, i8 %x3)
1789   %res1 = call <8 x float> @llvm.x86.avx512.mask.broadcastf32x2.256(<4 x float> %x0, <8 x float> zeroinitializer, i8 %x3)
1790   %res2 = call <8 x float> @llvm.x86.avx512.mask.broadcastf32x2.256(<4 x float> %x0, <8 x float> %x2, i8 -1)
1791   %res3 = fadd <8 x float> %res, %res1
1792   %res4 = fadd <8 x float> %res3, %res2
1793   ret <8 x float> %res4
1794 }
1795
1796 declare <8 x i32> @llvm.x86.avx512.mask.broadcasti32x2.256(<4 x i32>, <8 x i32>, i8)
1797
1798 define <8 x i32>@test_int_x86_avx512_mask_broadcasti32x2_256(<4 x i32> %x0, <8 x i32> %x2, i8 %x3) {
1799 ; CHECK-LABEL: test_int_x86_avx512_mask_broadcasti32x2_256:
1800 ; CHECK:       ## BB#0:
1801 ; CHECK-NEXT:    kmovb %edi, %k1
1802 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %ymm1 {%k1}
1803 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %ymm2 {%k1} {z}
1804 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %ymm0
1805 ; CHECK-NEXT:    vpaddd %ymm2, %ymm1, %ymm1
1806 ; CHECK-NEXT:    vpaddd %ymm0, %ymm1, %ymm0
1807 ; CHECK-NEXT:    retq
1808   %res = call <8 x i32> @llvm.x86.avx512.mask.broadcasti32x2.256(<4 x i32>  %x0, <8 x i32> %x2, i8 %x3)
1809   %res1 = call <8 x i32> @llvm.x86.avx512.mask.broadcasti32x2.256(<4 x i32> %x0, <8 x i32> zeroinitializer, i8 %x3)
1810   %res2 = call <8 x i32> @llvm.x86.avx512.mask.broadcasti32x2.256(<4 x i32> %x0, <8 x i32> %x2, i8 -1)
1811   %res3 = add <8 x i32> %res, %res1
1812   %res4 = add <8 x i32> %res3, %res2
1813   ret <8 x i32> %res4
1814 }
1815
1816 declare <4 x i32> @llvm.x86.avx512.mask.broadcasti32x2.128(<4 x i32>, <4 x i32>, i8)
1817
1818 define <4 x i32>@test_int_x86_avx512_mask_broadcasti32x2_128(<4 x i32> %x0, <4 x i32> %x2, i8 %x3) {
1819 ; CHECK-LABEL: test_int_x86_avx512_mask_broadcasti32x2_128:
1820 ; CHECK:       ## BB#0:
1821 ; CHECK-NEXT:    kmovb %edi, %k1
1822 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %xmm1 {%k1}
1823 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %xmm2 {%k1} {z}
1824 ; CHECK-NEXT:    vbroadcasti32x2 %xmm0, %xmm0
1825 ; CHECK-NEXT:    vpaddd %xmm2, %xmm1, %xmm1
1826 ; CHECK-NEXT:    vpaddd %xmm0, %xmm1, %xmm0
1827 ; CHECK-NEXT:    retq
1828   %res = call <4 x i32> @llvm.x86.avx512.mask.broadcasti32x2.128(<4 x i32>  %x0, <4 x i32> %x2, i8 %x3)
1829   %res1 = call <4 x i32> @llvm.x86.avx512.mask.broadcasti32x2.128(<4 x i32> %x0, <4 x i32> zeroinitializer, i8 %x3)
1830   %res2 = call <4 x i32> @llvm.x86.avx512.mask.broadcasti32x2.128(<4 x i32> %x0, <4 x i32> %x2, i8 -1)
1831   %res3 = add <4 x i32> %res, %res1
1832   %res4 = add <4 x i32> %res3, %res2
1833   ret <4 x i32> %res4
1834 }
1835
1836 declare <4 x i32> @llvm.x86.avx512.cvtmask2d.128(i8)
1837
1838 define <4 x i32>@test_int_x86_avx512_cvtmask2d_128(i8 %x0) {
1839 ; CHECK-LABEL: test_int_x86_avx512_cvtmask2d_128:
1840 ; CHECK:       ## BB#0:
1841 ; CHECK-NEXT:    kmovb %edi, %k0
1842 ; CHECK-NEXT:    vpmovm2d %k0, %xmm0
1843 ; CHECK-NEXT:    retq
1844   %res = call <4 x i32> @llvm.x86.avx512.cvtmask2d.128(i8 %x0)
1845   ret <4 x i32> %res
1846 }
1847
1848 declare <8 x i32> @llvm.x86.avx512.cvtmask2d.256(i8)
1849
1850 define <8 x i32>@test_int_x86_avx512_cvtmask2d_256(i8 %x0) {
1851 ; CHECK-LABEL: test_int_x86_avx512_cvtmask2d_256:
1852 ; CHECK:       ## BB#0:
1853 ; CHECK-NEXT:    kmovb %edi, %k0
1854 ; CHECK-NEXT:    vpmovm2d %k0, %ymm0
1855 ; CHECK-NEXT:    retq
1856   %res = call <8 x i32> @llvm.x86.avx512.cvtmask2d.256(i8 %x0)
1857   ret <8 x i32> %res
1858 }
1859
1860 declare <2 x i64> @llvm.x86.avx512.cvtmask2q.128(i8)
1861
1862 define <2 x i64>@test_int_x86_avx512_cvtmask2q_128(i8 %x0) {
1863 ; CHECK-LABEL: test_int_x86_avx512_cvtmask2q_128:
1864 ; CHECK:       ## BB#0:
1865 ; CHECK-NEXT:    kmovb %edi, %k0
1866 ; CHECK-NEXT:    vpmovm2q %k0, %xmm0
1867 ; CHECK-NEXT:    retq
1868   %res = call <2 x i64> @llvm.x86.avx512.cvtmask2q.128(i8 %x0)
1869   ret <2 x i64> %res
1870 }
1871
1872 declare <4 x i64> @llvm.x86.avx512.cvtmask2q.256(i8)
1873
1874 define <4 x i64>@test_int_x86_avx512_cvtmask2q_256(i8 %x0) {
1875 ; CHECK-LABEL: test_int_x86_avx512_cvtmask2q_256:
1876 ; CHECK:       ## BB#0:
1877 ; CHECK-NEXT:    kmovb %edi, %k0
1878 ; CHECK-NEXT:    vpmovm2q %k0, %ymm0
1879 ; CHECK-NEXT:    retq
1880   %res = call <4 x i64> @llvm.x86.avx512.cvtmask2q.256(i8 %x0)
1881   ret <4 x i64> %res
1882 }