1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+avx512cd,+avx512vl | FileCheck %s --check-prefixes=CHECK,X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512cd,+avx512vl | FileCheck %s --check-prefixes=CHECK,X64
5 declare <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32>, <4 x i32>, i8)
7 define <4 x i32>@test_int_x86_avx512_mask_vplzcnt_d_128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2) {
8 ; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_d_128:
10 ; X86-NEXT: vplzcntd %xmm0, %xmm2
11 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
12 ; X86-NEXT: kmovw %eax, %k1
13 ; X86-NEXT: vplzcntd %xmm0, %xmm1 {%k1}
14 ; X86-NEXT: vplzcntd %xmm0, %xmm0 {%k1} {z}
15 ; X86-NEXT: vpaddd %xmm0, %xmm2, %xmm0
16 ; X86-NEXT: vpaddd %xmm0, %xmm1, %xmm0
19 ; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_d_128:
21 ; X64-NEXT: vplzcntd %xmm0, %xmm2
22 ; X64-NEXT: kmovw %edi, %k1
23 ; X64-NEXT: vplzcntd %xmm0, %xmm1 {%k1}
24 ; X64-NEXT: vplzcntd %xmm0, %xmm0 {%k1} {z}
25 ; X64-NEXT: vpaddd %xmm0, %xmm2, %xmm0
26 ; X64-NEXT: vpaddd %xmm0, %xmm1, %xmm0
28 %res = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2)
29 %res1 = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 -1)
30 %res3 = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> zeroinitializer, i8 %x2)
31 %res2 = add <4 x i32> %res, %res1
32 %res4 = add <4 x i32> %res2, %res3
36 declare <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32>, <8 x i32>, i8)
38 define <8 x i32>@test_int_x86_avx512_mask_vplzcnt_d_256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2) {
39 ; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_d_256:
41 ; X86-NEXT: vplzcntd %ymm0, %ymm2
42 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
43 ; X86-NEXT: kmovw %eax, %k1
44 ; X86-NEXT: vplzcntd %ymm0, %ymm1 {%k1}
45 ; X86-NEXT: vpaddd %ymm2, %ymm1, %ymm0
48 ; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_d_256:
50 ; X64-NEXT: vplzcntd %ymm0, %ymm2
51 ; X64-NEXT: kmovw %edi, %k1
52 ; X64-NEXT: vplzcntd %ymm0, %ymm1 {%k1}
53 ; X64-NEXT: vpaddd %ymm2, %ymm1, %ymm0
55 %res = call <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2)
56 %res1 = call <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 -1)
57 %res2 = add <8 x i32> %res, %res1
61 declare <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64>, <2 x i64>, i8)
63 define <2 x i64>@test_int_x86_avx512_mask_vplzcnt_q_128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2) {
64 ; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_q_128:
66 ; X86-NEXT: vplzcntq %xmm0, %xmm2
67 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
68 ; X86-NEXT: kmovw %eax, %k1
69 ; X86-NEXT: vplzcntq %xmm0, %xmm1 {%k1}
70 ; X86-NEXT: vpaddq %xmm2, %xmm1, %xmm0
73 ; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_q_128:
75 ; X64-NEXT: vplzcntq %xmm0, %xmm2
76 ; X64-NEXT: kmovw %edi, %k1
77 ; X64-NEXT: vplzcntq %xmm0, %xmm1 {%k1}
78 ; X64-NEXT: vpaddq %xmm2, %xmm1, %xmm0
80 %res = call <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2)
81 %res1 = call <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 -1)
82 %res2 = add <2 x i64> %res, %res1
86 declare <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64>, <4 x i64>, i8)
88 define <4 x i64>@test_int_x86_avx512_mask_vplzcnt_q_256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2) {
89 ; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_q_256:
91 ; X86-NEXT: vplzcntq %ymm0, %ymm2
92 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
93 ; X86-NEXT: kmovw %eax, %k1
94 ; X86-NEXT: vplzcntq %ymm0, %ymm1 {%k1}
95 ; X86-NEXT: vpaddq %ymm2, %ymm1, %ymm0
98 ; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_q_256:
100 ; X64-NEXT: vplzcntq %ymm0, %ymm2
101 ; X64-NEXT: kmovw %edi, %k1
102 ; X64-NEXT: vplzcntq %ymm0, %ymm1 {%k1}
103 ; X64-NEXT: vpaddq %ymm2, %ymm1, %ymm0
105 %res = call <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2)
106 %res1 = call <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 -1)
107 %res2 = add <4 x i64> %res, %res1
111 define <8 x i32> @test_x86_vbroadcastmw_256(i16 %a0) {
112 ; X86-LABEL: test_x86_vbroadcastmw_256:
114 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
115 ; X86-NEXT: vpbroadcastd %eax, %ymm0
118 ; X64-LABEL: test_x86_vbroadcastmw_256:
120 ; X64-NEXT: movzwl %di, %eax
121 ; X64-NEXT: vpbroadcastd %eax, %ymm0
123 %res = call <8 x i32> @llvm.x86.avx512.broadcastmw.256(i16 %a0) ;
126 declare <8 x i32> @llvm.x86.avx512.broadcastmw.256(i16)
128 define <4 x i32> @test_x86_vbroadcastmw_128(i16 %a0) {
129 ; X86-LABEL: test_x86_vbroadcastmw_128:
131 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
132 ; X86-NEXT: vpbroadcastd %eax, %xmm0
135 ; X64-LABEL: test_x86_vbroadcastmw_128:
137 ; X64-NEXT: movzwl %di, %eax
138 ; X64-NEXT: vpbroadcastd %eax, %xmm0
140 %res = call <4 x i32> @llvm.x86.avx512.broadcastmw.128(i16 %a0) ;
143 declare <4 x i32> @llvm.x86.avx512.broadcastmw.128(i16)
145 define <4 x i64> @test_x86_broadcastmb_256(i8 %a0) {
146 ; X86-LABEL: test_x86_broadcastmb_256:
148 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
149 ; X86-NEXT: vmovd %eax, %xmm0
150 ; X86-NEXT: vpbroadcastq %xmm0, %ymm0
153 ; X64-LABEL: test_x86_broadcastmb_256:
155 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
156 ; X64-NEXT: movzbl %dil, %eax
157 ; X64-NEXT: vpbroadcastq %rax, %ymm0
159 %res = call <4 x i64> @llvm.x86.avx512.broadcastmb.256(i8 %a0) ;
162 declare <4 x i64> @llvm.x86.avx512.broadcastmb.256(i8)
164 define <2 x i64> @test_x86_broadcastmb_128(i8 %a0) {
165 ; X86-LABEL: test_x86_broadcastmb_128:
167 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
168 ; X86-NEXT: vmovd %eax, %xmm0
169 ; X86-NEXT: vpbroadcastq %xmm0, %xmm0
172 ; X64-LABEL: test_x86_broadcastmb_128:
174 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
175 ; X64-NEXT: movzbl %dil, %eax
176 ; X64-NEXT: vpbroadcastq %rax, %xmm0
178 %res = call <2 x i64> @llvm.x86.avx512.broadcastmb.128(i8 %a0) ;
181 declare <2 x i64> @llvm.x86.avx512.broadcastmb.128(i8)
183 declare <4 x i32> @llvm.x86.avx512.mask.conflict.d.128(<4 x i32>, <4 x i32>, i8)
185 define <4 x i32> @test_int_x86_avx512_mask_vpconflict_d_128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2) {
186 ; X86-LABEL: test_int_x86_avx512_mask_vpconflict_d_128:
188 ; X86-NEXT: vpconflictd %xmm0, %xmm2
189 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
190 ; X86-NEXT: kmovw %eax, %k1
191 ; X86-NEXT: vpconflictd %xmm0, %xmm1 {%k1}
192 ; X86-NEXT: vpconflictd %xmm0, %xmm0 {%k1} {z}
193 ; X86-NEXT: vpaddd %xmm0, %xmm2, %xmm0
194 ; X86-NEXT: vpaddd %xmm0, %xmm1, %xmm0
197 ; X64-LABEL: test_int_x86_avx512_mask_vpconflict_d_128:
199 ; X64-NEXT: vpconflictd %xmm0, %xmm2
200 ; X64-NEXT: kmovw %edi, %k1
201 ; X64-NEXT: vpconflictd %xmm0, %xmm1 {%k1}
202 ; X64-NEXT: vpconflictd %xmm0, %xmm0 {%k1} {z}
203 ; X64-NEXT: vpaddd %xmm0, %xmm2, %xmm0
204 ; X64-NEXT: vpaddd %xmm0, %xmm1, %xmm0
206 %res = call <4 x i32> @llvm.x86.avx512.mask.conflict.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2)
207 %res1 = call <4 x i32> @llvm.x86.avx512.mask.conflict.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 -1)
208 %res3 = call <4 x i32> @llvm.x86.avx512.mask.conflict.d.128(<4 x i32> %x0, <4 x i32> zeroinitializer, i8 %x2)
209 %res2 = add <4 x i32> %res, %res1
210 %res4 = add <4 x i32> %res2, %res3
214 declare <8 x i32> @llvm.x86.avx512.mask.conflict.d.256(<8 x i32>, <8 x i32>, i8)
216 define <8 x i32> @test_int_x86_avx512_mask_vpconflict_d_256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2) {
217 ; X86-LABEL: test_int_x86_avx512_mask_vpconflict_d_256:
219 ; X86-NEXT: vpconflictd %ymm0, %ymm2
220 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
221 ; X86-NEXT: kmovw %eax, %k1
222 ; X86-NEXT: vpconflictd %ymm0, %ymm1 {%k1}
223 ; X86-NEXT: vpconflictd %ymm0, %ymm0 {%k1} {z}
224 ; X86-NEXT: vpaddd %ymm0, %ymm2, %ymm0
225 ; X86-NEXT: vpaddd %ymm0, %ymm1, %ymm0
228 ; X64-LABEL: test_int_x86_avx512_mask_vpconflict_d_256:
230 ; X64-NEXT: vpconflictd %ymm0, %ymm2
231 ; X64-NEXT: kmovw %edi, %k1
232 ; X64-NEXT: vpconflictd %ymm0, %ymm1 {%k1}
233 ; X64-NEXT: vpconflictd %ymm0, %ymm0 {%k1} {z}
234 ; X64-NEXT: vpaddd %ymm0, %ymm2, %ymm0
235 ; X64-NEXT: vpaddd %ymm0, %ymm1, %ymm0
237 %res = call <8 x i32> @llvm.x86.avx512.mask.conflict.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2)
238 %res1 = call <8 x i32> @llvm.x86.avx512.mask.conflict.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 -1)
239 %res2 = call <8 x i32> @llvm.x86.avx512.mask.conflict.d.256(<8 x i32> %x0, <8 x i32> zeroinitializer, i8 %x2)
240 %res3 = add <8 x i32> %res, %res1
241 %res4 = add <8 x i32> %res2, %res3
245 declare <2 x i64> @llvm.x86.avx512.mask.conflict.q.128(<2 x i64>, <2 x i64>, i8)
247 define <2 x i64> @test_int_x86_avx512_mask_vpconflict_q_128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2) {
248 ; X86-LABEL: test_int_x86_avx512_mask_vpconflict_q_128:
250 ; X86-NEXT: vpconflictq %xmm0, %xmm2
251 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
252 ; X86-NEXT: kmovw %eax, %k1
253 ; X86-NEXT: vpconflictq %xmm0, %xmm1 {%k1}
254 ; X86-NEXT: vpconflictq %xmm0, %xmm0 {%k1} {z}
255 ; X86-NEXT: vpaddq %xmm0, %xmm2, %xmm0
256 ; X86-NEXT: vpaddq %xmm0, %xmm1, %xmm0
259 ; X64-LABEL: test_int_x86_avx512_mask_vpconflict_q_128:
261 ; X64-NEXT: vpconflictq %xmm0, %xmm2
262 ; X64-NEXT: kmovw %edi, %k1
263 ; X64-NEXT: vpconflictq %xmm0, %xmm1 {%k1}
264 ; X64-NEXT: vpconflictq %xmm0, %xmm0 {%k1} {z}
265 ; X64-NEXT: vpaddq %xmm0, %xmm2, %xmm0
266 ; X64-NEXT: vpaddq %xmm0, %xmm1, %xmm0
268 %res = call <2 x i64> @llvm.x86.avx512.mask.conflict.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2)
269 %res1 = call <2 x i64> @llvm.x86.avx512.mask.conflict.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 -1)
270 %res2 = call <2 x i64> @llvm.x86.avx512.mask.conflict.q.128(<2 x i64> %x0, <2 x i64> zeroinitializer, i8 %x2)
271 %res3 = add <2 x i64> %res, %res1
272 %res4 = add <2 x i64> %res2, %res3
276 declare <4 x i64> @llvm.x86.avx512.mask.conflict.q.256(<4 x i64>, <4 x i64>, i8)
278 define <4 x i64> @test_int_x86_avx512_mask_vpconflict_q_256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2) {
279 ; X86-LABEL: test_int_x86_avx512_mask_vpconflict_q_256:
281 ; X86-NEXT: vpconflictq %ymm0, %ymm2
282 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
283 ; X86-NEXT: kmovw %eax, %k1
284 ; X86-NEXT: vpconflictq %ymm0, %ymm1 {%k1}
285 ; X86-NEXT: vpconflictq %ymm0, %ymm0 {%k1} {z}
286 ; X86-NEXT: vpaddq %ymm0, %ymm2, %ymm0
287 ; X86-NEXT: vpaddq %ymm0, %ymm1, %ymm0
290 ; X64-LABEL: test_int_x86_avx512_mask_vpconflict_q_256:
292 ; X64-NEXT: vpconflictq %ymm0, %ymm2
293 ; X64-NEXT: kmovw %edi, %k1
294 ; X64-NEXT: vpconflictq %ymm0, %ymm1 {%k1}
295 ; X64-NEXT: vpconflictq %ymm0, %ymm0 {%k1} {z}
296 ; X64-NEXT: vpaddq %ymm0, %ymm2, %ymm0
297 ; X64-NEXT: vpaddq %ymm0, %ymm1, %ymm0
299 %res = call <4 x i64> @llvm.x86.avx512.mask.conflict.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2)
300 %res1 = call <4 x i64> @llvm.x86.avx512.mask.conflict.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 -1)
301 %res2 = call <4 x i64> @llvm.x86.avx512.mask.conflict.q.256(<4 x i64> %x0, <4 x i64> zeroinitializer, i8 %x2)
302 %res3 = add <4 x i64> %res, %res1
303 %res4 = add <4 x i64> %res2, %res3