• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
4; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
5; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
6; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512,AVX512F
7; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=AVX512,AVX512BW
8; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefixes=AVX512,AVX512VL
9
10;
11; Truncate
12;
13
14define i1 @trunc_v2i64_v2i1(<2 x i64>) {
15; SSE-LABEL: trunc_v2i64_v2i1:
16; SSE:       # %bb.0:
17; SSE-NEXT:    psllq $63, %xmm0
18; SSE-NEXT:    movmskpd %xmm0, %eax
19; SSE-NEXT:    cmpb $3, %al
20; SSE-NEXT:    sete %al
21; SSE-NEXT:    retq
22;
23; AVX-LABEL: trunc_v2i64_v2i1:
24; AVX:       # %bb.0:
25; AVX-NEXT:    vpsllq $63, %xmm0, %xmm0
26; AVX-NEXT:    vmovmskpd %xmm0, %eax
27; AVX-NEXT:    cmpb $3, %al
28; AVX-NEXT:    sete %al
29; AVX-NEXT:    retq
30;
31; AVX512F-LABEL: trunc_v2i64_v2i1:
32; AVX512F:       # %bb.0:
33; AVX512F-NEXT:    vpsllq $63, %xmm0, %xmm0
34; AVX512F-NEXT:    vptestmq %zmm0, %zmm0, %k0
35; AVX512F-NEXT:    kmovw %k0, %eax
36; AVX512F-NEXT:    andb $3, %al
37; AVX512F-NEXT:    cmpb $3, %al
38; AVX512F-NEXT:    sete %al
39; AVX512F-NEXT:    vzeroupper
40; AVX512F-NEXT:    retq
41;
42; AVX512BW-LABEL: trunc_v2i64_v2i1:
43; AVX512BW:       # %bb.0:
44; AVX512BW-NEXT:    vpsllq $63, %xmm0, %xmm0
45; AVX512BW-NEXT:    vptestmq %zmm0, %zmm0, %k0
46; AVX512BW-NEXT:    kmovd %k0, %eax
47; AVX512BW-NEXT:    andb $3, %al
48; AVX512BW-NEXT:    cmpb $3, %al
49; AVX512BW-NEXT:    sete %al
50; AVX512BW-NEXT:    vzeroupper
51; AVX512BW-NEXT:    retq
52;
53; AVX512VL-LABEL: trunc_v2i64_v2i1:
54; AVX512VL:       # %bb.0:
55; AVX512VL-NEXT:    vpsllq $63, %xmm0, %xmm0
56; AVX512VL-NEXT:    vptestmq %xmm0, %xmm0, %k0
57; AVX512VL-NEXT:    kmovd %k0, %eax
58; AVX512VL-NEXT:    cmpb $3, %al
59; AVX512VL-NEXT:    sete %al
60; AVX512VL-NEXT:    retq
61  %a = trunc <2 x i64> %0 to <2 x i1>
62  %b = call i1 @llvm.vector.reduce.and.v2i1(<2 x i1> %a)
63  ret i1 %b
64}
65
66define i1 @trunc_v4i32_v4i1(<4 x i32>) {
67; SSE-LABEL: trunc_v4i32_v4i1:
68; SSE:       # %bb.0:
69; SSE-NEXT:    pslld $31, %xmm0
70; SSE-NEXT:    movmskps %xmm0, %eax
71; SSE-NEXT:    cmpb $15, %al
72; SSE-NEXT:    sete %al
73; SSE-NEXT:    retq
74;
75; AVX-LABEL: trunc_v4i32_v4i1:
76; AVX:       # %bb.0:
77; AVX-NEXT:    vpslld $31, %xmm0, %xmm0
78; AVX-NEXT:    vmovmskps %xmm0, %eax
79; AVX-NEXT:    cmpb $15, %al
80; AVX-NEXT:    sete %al
81; AVX-NEXT:    retq
82;
83; AVX512F-LABEL: trunc_v4i32_v4i1:
84; AVX512F:       # %bb.0:
85; AVX512F-NEXT:    vpslld $31, %xmm0, %xmm0
86; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
87; AVX512F-NEXT:    kmovw %k0, %eax
88; AVX512F-NEXT:    andb $15, %al
89; AVX512F-NEXT:    cmpb $15, %al
90; AVX512F-NEXT:    sete %al
91; AVX512F-NEXT:    vzeroupper
92; AVX512F-NEXT:    retq
93;
94; AVX512BW-LABEL: trunc_v4i32_v4i1:
95; AVX512BW:       # %bb.0:
96; AVX512BW-NEXT:    vpslld $31, %xmm0, %xmm0
97; AVX512BW-NEXT:    vptestmd %zmm0, %zmm0, %k0
98; AVX512BW-NEXT:    kmovd %k0, %eax
99; AVX512BW-NEXT:    andb $15, %al
100; AVX512BW-NEXT:    cmpb $15, %al
101; AVX512BW-NEXT:    sete %al
102; AVX512BW-NEXT:    vzeroupper
103; AVX512BW-NEXT:    retq
104;
105; AVX512VL-LABEL: trunc_v4i32_v4i1:
106; AVX512VL:       # %bb.0:
107; AVX512VL-NEXT:    vpslld $31, %xmm0, %xmm0
108; AVX512VL-NEXT:    vptestmd %xmm0, %xmm0, %k0
109; AVX512VL-NEXT:    kmovd %k0, %eax
110; AVX512VL-NEXT:    cmpb $15, %al
111; AVX512VL-NEXT:    sete %al
112; AVX512VL-NEXT:    retq
113  %a = trunc <4 x i32> %0 to <4 x i1>
114  %b = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
115  ret i1 %b
116}
117
118define i1 @trunc_v8i16_v8i1(<8 x i8>) {
119; SSE2-LABEL: trunc_v8i16_v8i1:
120; SSE2:       # %bb.0:
121; SSE2-NEXT:    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
122; SSE2-NEXT:    psllw $15, %xmm0
123; SSE2-NEXT:    packsswb %xmm0, %xmm0
124; SSE2-NEXT:    pmovmskb %xmm0, %eax
125; SSE2-NEXT:    cmpb $-1, %al
126; SSE2-NEXT:    sete %al
127; SSE2-NEXT:    retq
128;
129; SSE41-LABEL: trunc_v8i16_v8i1:
130; SSE41:       # %bb.0:
131; SSE41-NEXT:    pmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
132; SSE41-NEXT:    psllw $15, %xmm0
133; SSE41-NEXT:    packsswb %xmm0, %xmm0
134; SSE41-NEXT:    pmovmskb %xmm0, %eax
135; SSE41-NEXT:    cmpb $-1, %al
136; SSE41-NEXT:    sete %al
137; SSE41-NEXT:    retq
138;
139; AVX-LABEL: trunc_v8i16_v8i1:
140; AVX:       # %bb.0:
141; AVX-NEXT:    vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
142; AVX-NEXT:    vpsllw $15, %xmm0, %xmm0
143; AVX-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
144; AVX-NEXT:    vpmovmskb %xmm0, %eax
145; AVX-NEXT:    cmpb $-1, %al
146; AVX-NEXT:    sete %al
147; AVX-NEXT:    retq
148;
149; AVX512F-LABEL: trunc_v8i16_v8i1:
150; AVX512F:       # %bb.0:
151; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
152; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
153; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
154; AVX512F-NEXT:    kmovw %k0, %eax
155; AVX512F-NEXT:    cmpb $-1, %al
156; AVX512F-NEXT:    sete %al
157; AVX512F-NEXT:    vzeroupper
158; AVX512F-NEXT:    retq
159;
160; AVX512BW-LABEL: trunc_v8i16_v8i1:
161; AVX512BW:       # %bb.0:
162; AVX512BW-NEXT:    vpsllw $7, %xmm0, %xmm0
163; AVX512BW-NEXT:    vpmovb2m %zmm0, %k0
164; AVX512BW-NEXT:    kmovd %k0, %eax
165; AVX512BW-NEXT:    cmpb $-1, %al
166; AVX512BW-NEXT:    sete %al
167; AVX512BW-NEXT:    vzeroupper
168; AVX512BW-NEXT:    retq
169;
170; AVX512VL-LABEL: trunc_v8i16_v8i1:
171; AVX512VL:       # %bb.0:
172; AVX512VL-NEXT:    vpsllw $7, %xmm0, %xmm0
173; AVX512VL-NEXT:    vpmovb2m %xmm0, %k0
174; AVX512VL-NEXT:    kmovd %k0, %eax
175; AVX512VL-NEXT:    cmpb $-1, %al
176; AVX512VL-NEXT:    sete %al
177; AVX512VL-NEXT:    retq
178  %a = trunc <8 x i8> %0 to <8 x i1>
179  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
180  ret i1 %b
181}
182
183define i1 @trunc_v16i8_v16i1(<16 x i8>) {
184; SSE-LABEL: trunc_v16i8_v16i1:
185; SSE:       # %bb.0:
186; SSE-NEXT:    psllw $7, %xmm0
187; SSE-NEXT:    pmovmskb %xmm0, %eax
188; SSE-NEXT:    cmpw $-1, %ax
189; SSE-NEXT:    sete %al
190; SSE-NEXT:    retq
191;
192; AVX-LABEL: trunc_v16i8_v16i1:
193; AVX:       # %bb.0:
194; AVX-NEXT:    vpsllw $7, %xmm0, %xmm0
195; AVX-NEXT:    vpmovmskb %xmm0, %eax
196; AVX-NEXT:    cmpw $-1, %ax
197; AVX-NEXT:    sete %al
198; AVX-NEXT:    retq
199;
200; AVX512-LABEL: trunc_v16i8_v16i1:
201; AVX512:       # %bb.0:
202; AVX512-NEXT:    vpsllw $7, %xmm0, %xmm0
203; AVX512-NEXT:    vpmovmskb %xmm0, %eax
204; AVX512-NEXT:    cmpw $-1, %ax
205; AVX512-NEXT:    sete %al
206; AVX512-NEXT:    retq
207  %a = trunc <16 x i8> %0 to <16 x i1>
208  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
209  ret i1 %b
210}
211
212define i1 @trunc_v4i64_v4i1(<4 x i64>) {
213; SSE-LABEL: trunc_v4i64_v4i1:
214; SSE:       # %bb.0:
215; SSE-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
216; SSE-NEXT:    pslld $31, %xmm0
217; SSE-NEXT:    movmskps %xmm0, %eax
218; SSE-NEXT:    cmpb $15, %al
219; SSE-NEXT:    sete %al
220; SSE-NEXT:    retq
221;
222; AVX-LABEL: trunc_v4i64_v4i1:
223; AVX:       # %bb.0:
224; AVX-NEXT:    vextractf128 $1, %ymm0, %xmm1
225; AVX-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
226; AVX-NEXT:    vpslld $31, %xmm0, %xmm0
227; AVX-NEXT:    vmovmskps %xmm0, %eax
228; AVX-NEXT:    cmpb $15, %al
229; AVX-NEXT:    sete %al
230; AVX-NEXT:    vzeroupper
231; AVX-NEXT:    retq
232;
233; AVX512F-LABEL: trunc_v4i64_v4i1:
234; AVX512F:       # %bb.0:
235; AVX512F-NEXT:    vpsllq $63, %ymm0, %ymm0
236; AVX512F-NEXT:    vptestmq %zmm0, %zmm0, %k0
237; AVX512F-NEXT:    kmovw %k0, %eax
238; AVX512F-NEXT:    andb $15, %al
239; AVX512F-NEXT:    cmpb $15, %al
240; AVX512F-NEXT:    sete %al
241; AVX512F-NEXT:    vzeroupper
242; AVX512F-NEXT:    retq
243;
244; AVX512BW-LABEL: trunc_v4i64_v4i1:
245; AVX512BW:       # %bb.0:
246; AVX512BW-NEXT:    vpsllq $63, %ymm0, %ymm0
247; AVX512BW-NEXT:    vptestmq %zmm0, %zmm0, %k0
248; AVX512BW-NEXT:    kmovd %k0, %eax
249; AVX512BW-NEXT:    andb $15, %al
250; AVX512BW-NEXT:    cmpb $15, %al
251; AVX512BW-NEXT:    sete %al
252; AVX512BW-NEXT:    vzeroupper
253; AVX512BW-NEXT:    retq
254;
255; AVX512VL-LABEL: trunc_v4i64_v4i1:
256; AVX512VL:       # %bb.0:
257; AVX512VL-NEXT:    vpsllq $63, %ymm0, %ymm0
258; AVX512VL-NEXT:    vptestmq %ymm0, %ymm0, %k0
259; AVX512VL-NEXT:    kmovd %k0, %eax
260; AVX512VL-NEXT:    cmpb $15, %al
261; AVX512VL-NEXT:    sete %al
262; AVX512VL-NEXT:    vzeroupper
263; AVX512VL-NEXT:    retq
264  %a = trunc <4 x i64> %0 to <4 x i1>
265  %b = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
266  ret i1 %b
267}
268
269define i1 @trunc_v8i32_v8i1(<8 x i32>) {
270; SSE2-LABEL: trunc_v8i32_v8i1:
271; SSE2:       # %bb.0:
272; SSE2-NEXT:    pslld $16, %xmm1
273; SSE2-NEXT:    psrad $16, %xmm1
274; SSE2-NEXT:    pslld $16, %xmm0
275; SSE2-NEXT:    psrad $16, %xmm0
276; SSE2-NEXT:    packssdw %xmm1, %xmm0
277; SSE2-NEXT:    psllw $15, %xmm0
278; SSE2-NEXT:    packsswb %xmm0, %xmm0
279; SSE2-NEXT:    pmovmskb %xmm0, %eax
280; SSE2-NEXT:    cmpb $-1, %al
281; SSE2-NEXT:    sete %al
282; SSE2-NEXT:    retq
283;
284; SSE41-LABEL: trunc_v8i32_v8i1:
285; SSE41:       # %bb.0:
286; SSE41-NEXT:    pxor %xmm2, %xmm2
287; SSE41-NEXT:    pblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
288; SSE41-NEXT:    pblendw {{.*#+}} xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3],xmm0[4],xmm2[5],xmm0[6],xmm2[7]
289; SSE41-NEXT:    packusdw %xmm1, %xmm0
290; SSE41-NEXT:    psllw $15, %xmm0
291; SSE41-NEXT:    packsswb %xmm0, %xmm0
292; SSE41-NEXT:    pmovmskb %xmm0, %eax
293; SSE41-NEXT:    cmpb $-1, %al
294; SSE41-NEXT:    sete %al
295; SSE41-NEXT:    retq
296;
297; AVX1-LABEL: trunc_v8i32_v8i1:
298; AVX1:       # %bb.0:
299; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
300; AVX1-NEXT:    vmovdqa {{.*#+}} xmm2 = <0,1,4,5,8,9,12,13,u,u,u,u,u,u,u,u>
301; AVX1-NEXT:    vpshufb %xmm2, %xmm1, %xmm1
302; AVX1-NEXT:    vpshufb %xmm2, %xmm0, %xmm0
303; AVX1-NEXT:    vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
304; AVX1-NEXT:    vpsllw $15, %xmm0, %xmm0
305; AVX1-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
306; AVX1-NEXT:    vpmovmskb %xmm0, %eax
307; AVX1-NEXT:    cmpb $-1, %al
308; AVX1-NEXT:    sete %al
309; AVX1-NEXT:    vzeroupper
310; AVX1-NEXT:    retq
311;
312; AVX2-LABEL: trunc_v8i32_v8i1:
313; AVX2:       # %bb.0:
314; AVX2-NEXT:    vpshufb {{.*#+}} ymm0 = ymm0[0,1,4,5,8,9,12,13,u,u,u,u,u,u,u,u,16,17,20,21,24,25,28,29,u,u,u,u,u,u,u,u]
315; AVX2-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
316; AVX2-NEXT:    vpsllw $15, %xmm0, %xmm0
317; AVX2-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
318; AVX2-NEXT:    vpmovmskb %xmm0, %eax
319; AVX2-NEXT:    cmpb $-1, %al
320; AVX2-NEXT:    sete %al
321; AVX2-NEXT:    vzeroupper
322; AVX2-NEXT:    retq
323;
324; AVX512F-LABEL: trunc_v8i32_v8i1:
325; AVX512F:       # %bb.0:
326; AVX512F-NEXT:    vpslld $31, %ymm0, %ymm0
327; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
328; AVX512F-NEXT:    kmovw %k0, %eax
329; AVX512F-NEXT:    cmpb $-1, %al
330; AVX512F-NEXT:    sete %al
331; AVX512F-NEXT:    vzeroupper
332; AVX512F-NEXT:    retq
333;
334; AVX512BW-LABEL: trunc_v8i32_v8i1:
335; AVX512BW:       # %bb.0:
336; AVX512BW-NEXT:    vpslld $31, %ymm0, %ymm0
337; AVX512BW-NEXT:    vptestmd %zmm0, %zmm0, %k0
338; AVX512BW-NEXT:    kmovd %k0, %eax
339; AVX512BW-NEXT:    cmpb $-1, %al
340; AVX512BW-NEXT:    sete %al
341; AVX512BW-NEXT:    vzeroupper
342; AVX512BW-NEXT:    retq
343;
344; AVX512VL-LABEL: trunc_v8i32_v8i1:
345; AVX512VL:       # %bb.0:
346; AVX512VL-NEXT:    vpslld $31, %ymm0, %ymm0
347; AVX512VL-NEXT:    vptestmd %ymm0, %ymm0, %k0
348; AVX512VL-NEXT:    kmovd %k0, %eax
349; AVX512VL-NEXT:    cmpb $-1, %al
350; AVX512VL-NEXT:    sete %al
351; AVX512VL-NEXT:    vzeroupper
352; AVX512VL-NEXT:    retq
353  %a = trunc <8 x i32> %0 to <8 x i1>
354  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
355  ret i1 %b
356}
357
358define i1 @trunc_v16i16_v16i1(<16 x i16>) {
359; SSE-LABEL: trunc_v16i16_v16i1:
360; SSE:       # %bb.0:
361; SSE-NEXT:    movdqa {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
362; SSE-NEXT:    pand %xmm2, %xmm1
363; SSE-NEXT:    pand %xmm2, %xmm0
364; SSE-NEXT:    packuswb %xmm1, %xmm0
365; SSE-NEXT:    psllw $7, %xmm0
366; SSE-NEXT:    pmovmskb %xmm0, %eax
367; SSE-NEXT:    cmpw $-1, %ax
368; SSE-NEXT:    sete %al
369; SSE-NEXT:    retq
370;
371; AVX1-LABEL: trunc_v16i16_v16i1:
372; AVX1:       # %bb.0:
373; AVX1-NEXT:    vandps {{.*}}(%rip), %ymm0, %ymm0
374; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
375; AVX1-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
376; AVX1-NEXT:    vpsllw $7, %xmm0, %xmm0
377; AVX1-NEXT:    vpmovmskb %xmm0, %eax
378; AVX1-NEXT:    cmpw $-1, %ax
379; AVX1-NEXT:    sete %al
380; AVX1-NEXT:    vzeroupper
381; AVX1-NEXT:    retq
382;
383; AVX2-LABEL: trunc_v16i16_v16i1:
384; AVX2:       # %bb.0:
385; AVX2-NEXT:    vpand {{.*}}(%rip), %ymm0, %ymm0
386; AVX2-NEXT:    vextracti128 $1, %ymm0, %xmm1
387; AVX2-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
388; AVX2-NEXT:    vpsllw $7, %xmm0, %xmm0
389; AVX2-NEXT:    vpmovmskb %xmm0, %eax
390; AVX2-NEXT:    cmpw $-1, %ax
391; AVX2-NEXT:    sete %al
392; AVX2-NEXT:    vzeroupper
393; AVX2-NEXT:    retq
394;
395; AVX512F-LABEL: trunc_v16i16_v16i1:
396; AVX512F:       # %bb.0:
397; AVX512F-NEXT:    vpmovsxwd %ymm0, %zmm0
398; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
399; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
400; AVX512F-NEXT:    kortestw %k0, %k0
401; AVX512F-NEXT:    setb %al
402; AVX512F-NEXT:    vzeroupper
403; AVX512F-NEXT:    retq
404;
405; AVX512BW-LABEL: trunc_v16i16_v16i1:
406; AVX512BW:       # %bb.0:
407; AVX512BW-NEXT:    vpsllw $15, %ymm0, %ymm0
408; AVX512BW-NEXT:    vpmovw2m %zmm0, %k0
409; AVX512BW-NEXT:    kortestw %k0, %k0
410; AVX512BW-NEXT:    setb %al
411; AVX512BW-NEXT:    vzeroupper
412; AVX512BW-NEXT:    retq
413;
414; AVX512VL-LABEL: trunc_v16i16_v16i1:
415; AVX512VL:       # %bb.0:
416; AVX512VL-NEXT:    vpsllw $15, %ymm0, %ymm0
417; AVX512VL-NEXT:    vpmovw2m %ymm0, %k0
418; AVX512VL-NEXT:    kortestw %k0, %k0
419; AVX512VL-NEXT:    setb %al
420; AVX512VL-NEXT:    vzeroupper
421; AVX512VL-NEXT:    retq
422  %a = trunc <16 x i16> %0 to <16 x i1>
423  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
424  ret i1 %b
425}
426
427define i1 @trunc_v32i8_v32i1(<32 x i8>) {
428; SSE-LABEL: trunc_v32i8_v32i1:
429; SSE:       # %bb.0:
430; SSE-NEXT:    pand %xmm1, %xmm0
431; SSE-NEXT:    psllw $7, %xmm0
432; SSE-NEXT:    pmovmskb %xmm0, %eax
433; SSE-NEXT:    cmpw $-1, %ax
434; SSE-NEXT:    sete %al
435; SSE-NEXT:    retq
436;
437; AVX1-LABEL: trunc_v32i8_v32i1:
438; AVX1:       # %bb.0:
439; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
440; AVX1-NEXT:    vpand %xmm1, %xmm0, %xmm0
441; AVX1-NEXT:    vpsllw $7, %xmm0, %xmm0
442; AVX1-NEXT:    vpmovmskb %xmm0, %eax
443; AVX1-NEXT:    cmpw $-1, %ax
444; AVX1-NEXT:    sete %al
445; AVX1-NEXT:    vzeroupper
446; AVX1-NEXT:    retq
447;
448; AVX2-LABEL: trunc_v32i8_v32i1:
449; AVX2:       # %bb.0:
450; AVX2-NEXT:    vpsllw $7, %ymm0, %ymm0
451; AVX2-NEXT:    vpmovmskb %ymm0, %eax
452; AVX2-NEXT:    cmpl $-1, %eax
453; AVX2-NEXT:    sete %al
454; AVX2-NEXT:    vzeroupper
455; AVX2-NEXT:    retq
456;
457; AVX512F-LABEL: trunc_v32i8_v32i1:
458; AVX512F:       # %bb.0:
459; AVX512F-NEXT:    vextracti128 $1, %ymm0, %xmm1
460; AVX512F-NEXT:    vpand %xmm1, %xmm0, %xmm0
461; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
462; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
463; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
464; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
465; AVX512F-NEXT:    kandw %k1, %k0, %k0
466; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
467; AVX512F-NEXT:    kandw %k1, %k0, %k0
468; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
469; AVX512F-NEXT:    kandw %k1, %k0, %k0
470; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
471; AVX512F-NEXT:    kandw %k1, %k0, %k0
472; AVX512F-NEXT:    kmovw %k0, %eax
473; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
474; AVX512F-NEXT:    vzeroupper
475; AVX512F-NEXT:    retq
476;
477; AVX512BW-LABEL: trunc_v32i8_v32i1:
478; AVX512BW:       # %bb.0:
479; AVX512BW-NEXT:    vpsllw $7, %ymm0, %ymm0
480; AVX512BW-NEXT:    vpmovmskb %ymm0, %eax
481; AVX512BW-NEXT:    cmpl $-1, %eax
482; AVX512BW-NEXT:    sete %al
483; AVX512BW-NEXT:    vzeroupper
484; AVX512BW-NEXT:    retq
485;
486; AVX512VL-LABEL: trunc_v32i8_v32i1:
487; AVX512VL:       # %bb.0:
488; AVX512VL-NEXT:    vpsllw $7, %ymm0, %ymm0
489; AVX512VL-NEXT:    vpmovmskb %ymm0, %eax
490; AVX512VL-NEXT:    cmpl $-1, %eax
491; AVX512VL-NEXT:    sete %al
492; AVX512VL-NEXT:    vzeroupper
493; AVX512VL-NEXT:    retq
494  %a = trunc <32 x i8> %0 to <32 x i1>
495  %b = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> %a)
496  ret i1 %b
497}
498
499define i1 @trunc_v8i64_v8i1(<8 x i64>) {
500; SSE2-LABEL: trunc_v8i64_v8i1:
501; SSE2:       # %bb.0:
502; SSE2-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
503; SSE2-NEXT:    pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
504; SSE2-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
505; SSE2-NEXT:    pshuflw {{.*#+}} xmm0 = xmm0[0,2,2,3,4,5,6,7]
506; SSE2-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
507; SSE2-NEXT:    pshufd {{.*#+}} xmm1 = xmm3[0,2,2,3]
508; SSE2-NEXT:    pshuflw {{.*#+}} xmm1 = xmm1[0,1,0,2,4,5,6,7]
509; SSE2-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[0,2,2,3]
510; SSE2-NEXT:    pshuflw {{.*#+}} xmm2 = xmm2[0,1,0,2,4,5,6,7]
511; SSE2-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
512; SSE2-NEXT:    movsd {{.*#+}} xmm2 = xmm0[0],xmm2[1]
513; SSE2-NEXT:    psllw $15, %xmm2
514; SSE2-NEXT:    packsswb %xmm2, %xmm2
515; SSE2-NEXT:    pmovmskb %xmm2, %eax
516; SSE2-NEXT:    cmpb $-1, %al
517; SSE2-NEXT:    sete %al
518; SSE2-NEXT:    retq
519;
520; SSE41-LABEL: trunc_v8i64_v8i1:
521; SSE41:       # %bb.0:
522; SSE41-NEXT:    pxor %xmm4, %xmm4
523; SSE41-NEXT:    pblendw {{.*#+}} xmm3 = xmm3[0],xmm4[1,2,3],xmm3[4],xmm4[5,6,7]
524; SSE41-NEXT:    pblendw {{.*#+}} xmm2 = xmm2[0],xmm4[1,2,3],xmm2[4],xmm4[5,6,7]
525; SSE41-NEXT:    packusdw %xmm3, %xmm2
526; SSE41-NEXT:    pblendw {{.*#+}} xmm1 = xmm1[0],xmm4[1,2,3],xmm1[4],xmm4[5,6,7]
527; SSE41-NEXT:    pblendw {{.*#+}} xmm0 = xmm0[0],xmm4[1,2,3],xmm0[4],xmm4[5,6,7]
528; SSE41-NEXT:    packusdw %xmm1, %xmm0
529; SSE41-NEXT:    packusdw %xmm2, %xmm0
530; SSE41-NEXT:    psllw $15, %xmm0
531; SSE41-NEXT:    packsswb %xmm0, %xmm0
532; SSE41-NEXT:    pmovmskb %xmm0, %eax
533; SSE41-NEXT:    cmpb $-1, %al
534; SSE41-NEXT:    sete %al
535; SSE41-NEXT:    retq
536;
537; AVX1-LABEL: trunc_v8i64_v8i1:
538; AVX1:       # %bb.0:
539; AVX1-NEXT:    vmovaps {{.*#+}} ymm2 = [65535,65535,65535,65535]
540; AVX1-NEXT:    vandps %ymm2, %ymm1, %ymm1
541; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm3
542; AVX1-NEXT:    vpackusdw %xmm3, %xmm1, %xmm1
543; AVX1-NEXT:    vandps %ymm2, %ymm0, %ymm0
544; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm2
545; AVX1-NEXT:    vpackusdw %xmm2, %xmm0, %xmm0
546; AVX1-NEXT:    vpackusdw %xmm1, %xmm0, %xmm0
547; AVX1-NEXT:    vpsllw $15, %xmm0, %xmm0
548; AVX1-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
549; AVX1-NEXT:    vpmovmskb %xmm0, %eax
550; AVX1-NEXT:    cmpb $-1, %al
551; AVX1-NEXT:    sete %al
552; AVX1-NEXT:    vzeroupper
553; AVX1-NEXT:    retq
554;
555; AVX2-LABEL: trunc_v8i64_v8i1:
556; AVX2:       # %bb.0:
557; AVX2-NEXT:    vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
558; AVX2-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
559; AVX2-NEXT:    vshufps {{.*#+}} ymm0 = ymm0[0,2],ymm2[0,2],ymm0[4,6],ymm2[4,6]
560; AVX2-NEXT:    vpshufb {{.*#+}} ymm0 = ymm0[0,1,4,5,8,9,12,13,u,u,u,u,u,u,u,u,16,17,20,21,24,25,28,29,u,u,u,u,u,u,u,u]
561; AVX2-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
562; AVX2-NEXT:    vpsllw $15, %xmm0, %xmm0
563; AVX2-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
564; AVX2-NEXT:    vpmovmskb %xmm0, %eax
565; AVX2-NEXT:    cmpb $-1, %al
566; AVX2-NEXT:    sete %al
567; AVX2-NEXT:    vzeroupper
568; AVX2-NEXT:    retq
569;
570; AVX512F-LABEL: trunc_v8i64_v8i1:
571; AVX512F:       # %bb.0:
572; AVX512F-NEXT:    vpsllq $63, %zmm0, %zmm0
573; AVX512F-NEXT:    vptestmq %zmm0, %zmm0, %k0
574; AVX512F-NEXT:    kmovw %k0, %eax
575; AVX512F-NEXT:    cmpb $-1, %al
576; AVX512F-NEXT:    sete %al
577; AVX512F-NEXT:    vzeroupper
578; AVX512F-NEXT:    retq
579;
580; AVX512BW-LABEL: trunc_v8i64_v8i1:
581; AVX512BW:       # %bb.0:
582; AVX512BW-NEXT:    vpsllq $63, %zmm0, %zmm0
583; AVX512BW-NEXT:    vptestmq %zmm0, %zmm0, %k0
584; AVX512BW-NEXT:    kmovd %k0, %eax
585; AVX512BW-NEXT:    cmpb $-1, %al
586; AVX512BW-NEXT:    sete %al
587; AVX512BW-NEXT:    vzeroupper
588; AVX512BW-NEXT:    retq
589;
590; AVX512VL-LABEL: trunc_v8i64_v8i1:
591; AVX512VL:       # %bb.0:
592; AVX512VL-NEXT:    vpsllq $63, %zmm0, %zmm0
593; AVX512VL-NEXT:    vptestmq %zmm0, %zmm0, %k0
594; AVX512VL-NEXT:    kmovd %k0, %eax
595; AVX512VL-NEXT:    cmpb $-1, %al
596; AVX512VL-NEXT:    sete %al
597; AVX512VL-NEXT:    vzeroupper
598; AVX512VL-NEXT:    retq
599  %a = trunc <8 x i64> %0 to <8 x i1>
600  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
601  ret i1 %b
602}
603
604define i1 @trunc_v16i32_v16i1(<16 x i32>) {
605; SSE2-LABEL: trunc_v16i32_v16i1:
606; SSE2:       # %bb.0:
607; SSE2-NEXT:    movdqa {{.*#+}} xmm4 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
608; SSE2-NEXT:    pand %xmm4, %xmm3
609; SSE2-NEXT:    pand %xmm4, %xmm2
610; SSE2-NEXT:    packuswb %xmm3, %xmm2
611; SSE2-NEXT:    pand %xmm4, %xmm1
612; SSE2-NEXT:    pand %xmm4, %xmm0
613; SSE2-NEXT:    packuswb %xmm1, %xmm0
614; SSE2-NEXT:    packuswb %xmm2, %xmm0
615; SSE2-NEXT:    psllw $7, %xmm0
616; SSE2-NEXT:    pmovmskb %xmm0, %eax
617; SSE2-NEXT:    cmpw $-1, %ax
618; SSE2-NEXT:    sete %al
619; SSE2-NEXT:    retq
620;
621; SSE41-LABEL: trunc_v16i32_v16i1:
622; SSE41:       # %bb.0:
623; SSE41-NEXT:    movdqa {{.*#+}} xmm4 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
624; SSE41-NEXT:    pand %xmm4, %xmm3
625; SSE41-NEXT:    pand %xmm4, %xmm2
626; SSE41-NEXT:    packusdw %xmm3, %xmm2
627; SSE41-NEXT:    pand %xmm4, %xmm1
628; SSE41-NEXT:    pand %xmm4, %xmm0
629; SSE41-NEXT:    packusdw %xmm1, %xmm0
630; SSE41-NEXT:    packuswb %xmm2, %xmm0
631; SSE41-NEXT:    psllw $7, %xmm0
632; SSE41-NEXT:    pmovmskb %xmm0, %eax
633; SSE41-NEXT:    cmpw $-1, %ax
634; SSE41-NEXT:    sete %al
635; SSE41-NEXT:    retq
636;
637; AVX1-LABEL: trunc_v16i32_v16i1:
638; AVX1:       # %bb.0:
639; AVX1-NEXT:    vmovaps {{.*#+}} ymm2 = [255,255,255,255,255,255,255,255]
640; AVX1-NEXT:    vandps %ymm2, %ymm1, %ymm1
641; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm3
642; AVX1-NEXT:    vpackusdw %xmm3, %xmm1, %xmm1
643; AVX1-NEXT:    vandps %ymm2, %ymm0, %ymm0
644; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm2
645; AVX1-NEXT:    vpackusdw %xmm2, %xmm0, %xmm0
646; AVX1-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
647; AVX1-NEXT:    vpsllw $7, %xmm0, %xmm0
648; AVX1-NEXT:    vpmovmskb %xmm0, %eax
649; AVX1-NEXT:    cmpw $-1, %ax
650; AVX1-NEXT:    sete %al
651; AVX1-NEXT:    vzeroupper
652; AVX1-NEXT:    retq
653;
654; AVX2-LABEL: trunc_v16i32_v16i1:
655; AVX2:       # %bb.0:
656; AVX2-NEXT:    vmovdqa {{.*#+}} ymm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15,16,17,20,21,24,25,28,29,24,25,28,29,28,29,30,31]
657; AVX2-NEXT:    vpshufb %ymm2, %ymm1, %ymm1
658; AVX2-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,2,2,3]
659; AVX2-NEXT:    vmovdqa {{.*#+}} xmm3 = [255,255,255,255,255,255,255,255]
660; AVX2-NEXT:    vpand %xmm3, %xmm1, %xmm1
661; AVX2-NEXT:    vpshufb %ymm2, %ymm0, %ymm0
662; AVX2-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
663; AVX2-NEXT:    vpand %xmm3, %xmm0, %xmm0
664; AVX2-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
665; AVX2-NEXT:    vpsllw $7, %xmm0, %xmm0
666; AVX2-NEXT:    vpmovmskb %xmm0, %eax
667; AVX2-NEXT:    cmpw $-1, %ax
668; AVX2-NEXT:    sete %al
669; AVX2-NEXT:    vzeroupper
670; AVX2-NEXT:    retq
671;
672; AVX512-LABEL: trunc_v16i32_v16i1:
673; AVX512:       # %bb.0:
674; AVX512-NEXT:    vpslld $31, %zmm0, %zmm0
675; AVX512-NEXT:    vptestmd %zmm0, %zmm0, %k0
676; AVX512-NEXT:    kortestw %k0, %k0
677; AVX512-NEXT:    setb %al
678; AVX512-NEXT:    vzeroupper
679; AVX512-NEXT:    retq
680  %a = trunc <16 x i32> %0 to <16 x i1>
681  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
682  ret i1 %b
683}
684
685define i1 @trunc_v32i16_v32i1(<32 x i16>) {
686; SSE-LABEL: trunc_v32i16_v32i1:
687; SSE:       # %bb.0:
688; SSE-NEXT:    movdqa {{.*#+}} xmm4 = [255,255,255,255,255,255,255,255]
689; SSE-NEXT:    pand %xmm4, %xmm3
690; SSE-NEXT:    pand %xmm4, %xmm2
691; SSE-NEXT:    packuswb %xmm3, %xmm2
692; SSE-NEXT:    pand %xmm4, %xmm1
693; SSE-NEXT:    pand %xmm4, %xmm0
694; SSE-NEXT:    packuswb %xmm1, %xmm0
695; SSE-NEXT:    pand %xmm2, %xmm0
696; SSE-NEXT:    psllw $7, %xmm0
697; SSE-NEXT:    pmovmskb %xmm0, %eax
698; SSE-NEXT:    cmpw $-1, %ax
699; SSE-NEXT:    sete %al
700; SSE-NEXT:    retq
701;
702; AVX1-LABEL: trunc_v32i16_v32i1:
703; AVX1:       # %bb.0:
704; AVX1-NEXT:    vandps %ymm1, %ymm0, %ymm0
705; AVX1-NEXT:    vandps {{.*}}(%rip), %ymm0, %ymm0
706; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
707; AVX1-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
708; AVX1-NEXT:    vpsllw $7, %xmm0, %xmm0
709; AVX1-NEXT:    vpmovmskb %xmm0, %eax
710; AVX1-NEXT:    cmpw $-1, %ax
711; AVX1-NEXT:    sete %al
712; AVX1-NEXT:    vzeroupper
713; AVX1-NEXT:    retq
714;
715; AVX2-LABEL: trunc_v32i16_v32i1:
716; AVX2:       # %bb.0:
717; AVX2-NEXT:    vmovdqa {{.*#+}} ymm2 = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
718; AVX2-NEXT:    vpand %ymm2, %ymm1, %ymm1
719; AVX2-NEXT:    vpand %ymm2, %ymm0, %ymm0
720; AVX2-NEXT:    vperm2i128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
721; AVX2-NEXT:    vinserti128 $1, %xmm1, %ymm0, %ymm0
722; AVX2-NEXT:    vpackuswb %ymm2, %ymm0, %ymm0
723; AVX2-NEXT:    vpsllw $7, %ymm0, %ymm0
724; AVX2-NEXT:    vpmovmskb %ymm0, %eax
725; AVX2-NEXT:    cmpl $-1, %eax
726; AVX2-NEXT:    sete %al
727; AVX2-NEXT:    vzeroupper
728; AVX2-NEXT:    retq
729;
730; AVX512F-LABEL: trunc_v32i16_v32i1:
731; AVX512F:       # %bb.0:
732; AVX512F-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
733; AVX512F-NEXT:    vpand %ymm1, %ymm0, %ymm0
734; AVX512F-NEXT:    vpmovsxwd %ymm0, %zmm0
735; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
736; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
737; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
738; AVX512F-NEXT:    kandw %k1, %k0, %k0
739; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
740; AVX512F-NEXT:    kandw %k1, %k0, %k0
741; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
742; AVX512F-NEXT:    kandw %k1, %k0, %k0
743; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
744; AVX512F-NEXT:    kandw %k1, %k0, %k0
745; AVX512F-NEXT:    kmovw %k0, %eax
746; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
747; AVX512F-NEXT:    vzeroupper
748; AVX512F-NEXT:    retq
749;
750; AVX512BW-LABEL: trunc_v32i16_v32i1:
751; AVX512BW:       # %bb.0:
752; AVX512BW-NEXT:    vpsllw $15, %zmm0, %zmm0
753; AVX512BW-NEXT:    vpmovw2m %zmm0, %k0
754; AVX512BW-NEXT:    kortestd %k0, %k0
755; AVX512BW-NEXT:    setb %al
756; AVX512BW-NEXT:    vzeroupper
757; AVX512BW-NEXT:    retq
758;
759; AVX512VL-LABEL: trunc_v32i16_v32i1:
760; AVX512VL:       # %bb.0:
761; AVX512VL-NEXT:    vpsllw $15, %zmm0, %zmm0
762; AVX512VL-NEXT:    vpmovw2m %zmm0, %k0
763; AVX512VL-NEXT:    kortestd %k0, %k0
764; AVX512VL-NEXT:    setb %al
765; AVX512VL-NEXT:    vzeroupper
766; AVX512VL-NEXT:    retq
767  %a = trunc <32 x i16> %0 to <32 x i1>
768  %b = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> %a)
769  ret i1 %b
770}
771
772define i1 @trunc_v64i8_v64i1(<64 x i8>) {
773; SSE-LABEL: trunc_v64i8_v64i1:
774; SSE:       # %bb.0:
775; SSE-NEXT:    pand %xmm3, %xmm1
776; SSE-NEXT:    pand %xmm2, %xmm1
777; SSE-NEXT:    pand %xmm0, %xmm1
778; SSE-NEXT:    psllw $7, %xmm1
779; SSE-NEXT:    pmovmskb %xmm1, %eax
780; SSE-NEXT:    cmpw $-1, %ax
781; SSE-NEXT:    sete %al
782; SSE-NEXT:    retq
783;
784; AVX1-LABEL: trunc_v64i8_v64i1:
785; AVX1:       # %bb.0:
786; AVX1-NEXT:    vandps %ymm1, %ymm0, %ymm0
787; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
788; AVX1-NEXT:    vandps %xmm1, %xmm0, %xmm0
789; AVX1-NEXT:    vpsllw $7, %xmm0, %xmm0
790; AVX1-NEXT:    vpmovmskb %xmm0, %eax
791; AVX1-NEXT:    cmpw $-1, %ax
792; AVX1-NEXT:    sete %al
793; AVX1-NEXT:    vzeroupper
794; AVX1-NEXT:    retq
795;
796; AVX2-LABEL: trunc_v64i8_v64i1:
797; AVX2:       # %bb.0:
798; AVX2-NEXT:    vpand %ymm1, %ymm0, %ymm0
799; AVX2-NEXT:    vpsllw $7, %ymm0, %ymm0
800; AVX2-NEXT:    vpmovmskb %ymm0, %eax
801; AVX2-NEXT:    cmpl $-1, %eax
802; AVX2-NEXT:    sete %al
803; AVX2-NEXT:    vzeroupper
804; AVX2-NEXT:    retq
805;
806; AVX512F-LABEL: trunc_v64i8_v64i1:
807; AVX512F:       # %bb.0:
808; AVX512F-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
809; AVX512F-NEXT:    vextracti128 $1, %ymm1, %xmm2
810; AVX512F-NEXT:    vextracti128 $1, %ymm0, %xmm3
811; AVX512F-NEXT:    vpand %xmm2, %xmm3, %xmm2
812; AVX512F-NEXT:    vpand %xmm2, %xmm1, %xmm1
813; AVX512F-NEXT:    vpand %xmm1, %xmm0, %xmm0
814; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
815; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
816; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
817; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
818; AVX512F-NEXT:    kandw %k1, %k0, %k0
819; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
820; AVX512F-NEXT:    kandw %k1, %k0, %k0
821; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
822; AVX512F-NEXT:    kandw %k1, %k0, %k0
823; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
824; AVX512F-NEXT:    kandw %k1, %k0, %k0
825; AVX512F-NEXT:    kmovw %k0, %eax
826; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
827; AVX512F-NEXT:    vzeroupper
828; AVX512F-NEXT:    retq
829;
830; AVX512BW-LABEL: trunc_v64i8_v64i1:
831; AVX512BW:       # %bb.0:
832; AVX512BW-NEXT:    vpsllw $7, %zmm0, %zmm0
833; AVX512BW-NEXT:    vpmovb2m %zmm0, %k0
834; AVX512BW-NEXT:    kortestq %k0, %k0
835; AVX512BW-NEXT:    setb %al
836; AVX512BW-NEXT:    vzeroupper
837; AVX512BW-NEXT:    retq
838;
839; AVX512VL-LABEL: trunc_v64i8_v64i1:
840; AVX512VL:       # %bb.0:
841; AVX512VL-NEXT:    vpsllw $7, %zmm0, %zmm0
842; AVX512VL-NEXT:    vpmovb2m %zmm0, %k0
843; AVX512VL-NEXT:    kortestq %k0, %k0
844; AVX512VL-NEXT:    setb %al
845; AVX512VL-NEXT:    vzeroupper
846; AVX512VL-NEXT:    retq
847  %a = trunc <64 x i8> %0 to <64 x i1>
848  %b = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> %a)
849  ret i1 %b
850}
851
852;
853; Comparison
854;
855
856define i1 @icmp_v2i64_v2i1(<2 x i64>) {
857; SSE2-LABEL: icmp_v2i64_v2i1:
858; SSE2:       # %bb.0:
859; SSE2-NEXT:    pxor %xmm1, %xmm1
860; SSE2-NEXT:    pcmpeqd %xmm0, %xmm1
861; SSE2-NEXT:    movmskps %xmm1, %eax
862; SSE2-NEXT:    cmpb $15, %al
863; SSE2-NEXT:    sete %al
864; SSE2-NEXT:    retq
865;
866; SSE41-LABEL: icmp_v2i64_v2i1:
867; SSE41:       # %bb.0:
868; SSE41-NEXT:    ptest %xmm0, %xmm0
869; SSE41-NEXT:    sete %al
870; SSE41-NEXT:    retq
871;
872; AVX-LABEL: icmp_v2i64_v2i1:
873; AVX:       # %bb.0:
874; AVX-NEXT:    vptest %xmm0, %xmm0
875; AVX-NEXT:    sete %al
876; AVX-NEXT:    retq
877;
878; AVX512F-LABEL: icmp_v2i64_v2i1:
879; AVX512F:       # %bb.0:
880; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
881; AVX512F-NEXT:    vptestnmq %zmm0, %zmm0, %k0
882; AVX512F-NEXT:    kmovw %k0, %eax
883; AVX512F-NEXT:    andb $3, %al
884; AVX512F-NEXT:    cmpb $3, %al
885; AVX512F-NEXT:    sete %al
886; AVX512F-NEXT:    vzeroupper
887; AVX512F-NEXT:    retq
888;
889; AVX512BW-LABEL: icmp_v2i64_v2i1:
890; AVX512BW:       # %bb.0:
891; AVX512BW-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
892; AVX512BW-NEXT:    vptestnmq %zmm0, %zmm0, %k0
893; AVX512BW-NEXT:    kmovd %k0, %eax
894; AVX512BW-NEXT:    andb $3, %al
895; AVX512BW-NEXT:    cmpb $3, %al
896; AVX512BW-NEXT:    sete %al
897; AVX512BW-NEXT:    vzeroupper
898; AVX512BW-NEXT:    retq
899;
900; AVX512VL-LABEL: icmp_v2i64_v2i1:
901; AVX512VL:       # %bb.0:
902; AVX512VL-NEXT:    vptestnmq %xmm0, %xmm0, %k0
903; AVX512VL-NEXT:    kmovd %k0, %eax
904; AVX512VL-NEXT:    cmpb $3, %al
905; AVX512VL-NEXT:    sete %al
906; AVX512VL-NEXT:    retq
907  %a = icmp eq <2 x i64> %0, zeroinitializer
908  %b = call i1 @llvm.vector.reduce.and.v2i1(<2 x i1> %a)
909  ret i1 %b
910}
911
912define i1 @icmp_v4i32_v4i1(<4 x i32>) {
913; SSE2-LABEL: icmp_v4i32_v4i1:
914; SSE2:       # %bb.0:
915; SSE2-NEXT:    pxor %xmm1, %xmm1
916; SSE2-NEXT:    pcmpeqd %xmm0, %xmm1
917; SSE2-NEXT:    movmskps %xmm1, %eax
918; SSE2-NEXT:    cmpb $15, %al
919; SSE2-NEXT:    sete %al
920; SSE2-NEXT:    retq
921;
922; SSE41-LABEL: icmp_v4i32_v4i1:
923; SSE41:       # %bb.0:
924; SSE41-NEXT:    ptest %xmm0, %xmm0
925; SSE41-NEXT:    sete %al
926; SSE41-NEXT:    retq
927;
928; AVX-LABEL: icmp_v4i32_v4i1:
929; AVX:       # %bb.0:
930; AVX-NEXT:    vptest %xmm0, %xmm0
931; AVX-NEXT:    sete %al
932; AVX-NEXT:    retq
933;
934; AVX512F-LABEL: icmp_v4i32_v4i1:
935; AVX512F:       # %bb.0:
936; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
937; AVX512F-NEXT:    vptestnmd %zmm0, %zmm0, %k0
938; AVX512F-NEXT:    kmovw %k0, %eax
939; AVX512F-NEXT:    andb $15, %al
940; AVX512F-NEXT:    cmpb $15, %al
941; AVX512F-NEXT:    sete %al
942; AVX512F-NEXT:    vzeroupper
943; AVX512F-NEXT:    retq
944;
945; AVX512BW-LABEL: icmp_v4i32_v4i1:
946; AVX512BW:       # %bb.0:
947; AVX512BW-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
948; AVX512BW-NEXT:    vptestnmd %zmm0, %zmm0, %k0
949; AVX512BW-NEXT:    kmovd %k0, %eax
950; AVX512BW-NEXT:    andb $15, %al
951; AVX512BW-NEXT:    cmpb $15, %al
952; AVX512BW-NEXT:    sete %al
953; AVX512BW-NEXT:    vzeroupper
954; AVX512BW-NEXT:    retq
955;
956; AVX512VL-LABEL: icmp_v4i32_v4i1:
957; AVX512VL:       # %bb.0:
958; AVX512VL-NEXT:    vptestnmd %xmm0, %xmm0, %k0
959; AVX512VL-NEXT:    kmovd %k0, %eax
960; AVX512VL-NEXT:    cmpb $15, %al
961; AVX512VL-NEXT:    sete %al
962; AVX512VL-NEXT:    retq
963  %a = icmp eq <4 x i32> %0, zeroinitializer
964  %b = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
965  ret i1 %b
966}
967
968define i1 @icmp_v8i16_v8i1(<8 x i8>) {
969; SSE-LABEL: icmp_v8i16_v8i1:
970; SSE:       # %bb.0:
971; SSE-NEXT:    pxor %xmm1, %xmm1
972; SSE-NEXT:    pcmpeqb %xmm0, %xmm1
973; SSE-NEXT:    pmovmskb %xmm1, %eax
974; SSE-NEXT:    cmpb $-1, %al
975; SSE-NEXT:    sete %al
976; SSE-NEXT:    retq
977;
978; AVX-LABEL: icmp_v8i16_v8i1:
979; AVX:       # %bb.0:
980; AVX-NEXT:    vpxor %xmm1, %xmm1, %xmm1
981; AVX-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm0
982; AVX-NEXT:    vpmovmskb %xmm0, %eax
983; AVX-NEXT:    cmpb $-1, %al
984; AVX-NEXT:    sete %al
985; AVX-NEXT:    retq
986;
987; AVX512F-LABEL: icmp_v8i16_v8i1:
988; AVX512F:       # %bb.0:
989; AVX512F-NEXT:    vpxor %xmm1, %xmm1, %xmm1
990; AVX512F-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm0
991; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
992; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
993; AVX512F-NEXT:    kmovw %k0, %eax
994; AVX512F-NEXT:    cmpb $-1, %al
995; AVX512F-NEXT:    sete %al
996; AVX512F-NEXT:    vzeroupper
997; AVX512F-NEXT:    retq
998;
999; AVX512BW-LABEL: icmp_v8i16_v8i1:
1000; AVX512BW:       # %bb.0:
1001; AVX512BW-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1002; AVX512BW-NEXT:    vptestnmb %zmm0, %zmm0, %k0
1003; AVX512BW-NEXT:    kmovd %k0, %eax
1004; AVX512BW-NEXT:    cmpb $-1, %al
1005; AVX512BW-NEXT:    sete %al
1006; AVX512BW-NEXT:    vzeroupper
1007; AVX512BW-NEXT:    retq
1008;
1009; AVX512VL-LABEL: icmp_v8i16_v8i1:
1010; AVX512VL:       # %bb.0:
1011; AVX512VL-NEXT:    vptestnmb %xmm0, %xmm0, %k0
1012; AVX512VL-NEXT:    kmovd %k0, %eax
1013; AVX512VL-NEXT:    cmpb $-1, %al
1014; AVX512VL-NEXT:    sete %al
1015; AVX512VL-NEXT:    retq
1016  %a = icmp eq <8 x i8> %0, zeroinitializer
1017  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
1018  ret i1 %b
1019}
1020
1021define i1 @icmp_v16i8_v16i1(<16 x i8>) {
1022; SSE2-LABEL: icmp_v16i8_v16i1:
1023; SSE2:       # %bb.0:
1024; SSE2-NEXT:    pxor %xmm1, %xmm1
1025; SSE2-NEXT:    pcmpeqb %xmm0, %xmm1
1026; SSE2-NEXT:    pmovmskb %xmm1, %eax
1027; SSE2-NEXT:    cmpw $-1, %ax
1028; SSE2-NEXT:    sete %al
1029; SSE2-NEXT:    retq
1030;
1031; SSE41-LABEL: icmp_v16i8_v16i1:
1032; SSE41:       # %bb.0:
1033; SSE41-NEXT:    ptest %xmm0, %xmm0
1034; SSE41-NEXT:    sete %al
1035; SSE41-NEXT:    retq
1036;
1037; AVX-LABEL: icmp_v16i8_v16i1:
1038; AVX:       # %bb.0:
1039; AVX-NEXT:    vptest %xmm0, %xmm0
1040; AVX-NEXT:    sete %al
1041; AVX-NEXT:    retq
1042;
1043; AVX512F-LABEL: icmp_v16i8_v16i1:
1044; AVX512F:       # %bb.0:
1045; AVX512F-NEXT:    vptest %xmm0, %xmm0
1046; AVX512F-NEXT:    sete %al
1047; AVX512F-NEXT:    retq
1048;
1049; AVX512BW-LABEL: icmp_v16i8_v16i1:
1050; AVX512BW:       # %bb.0:
1051; AVX512BW-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1052; AVX512BW-NEXT:    vptestnmb %zmm0, %zmm0, %k0
1053; AVX512BW-NEXT:    kortestw %k0, %k0
1054; AVX512BW-NEXT:    setb %al
1055; AVX512BW-NEXT:    vzeroupper
1056; AVX512BW-NEXT:    retq
1057;
1058; AVX512VL-LABEL: icmp_v16i8_v16i1:
1059; AVX512VL:       # %bb.0:
1060; AVX512VL-NEXT:    vptestnmb %xmm0, %xmm0, %k0
1061; AVX512VL-NEXT:    kortestw %k0, %k0
1062; AVX512VL-NEXT:    setb %al
1063; AVX512VL-NEXT:    retq
1064  %a = icmp eq <16 x i8> %0, zeroinitializer
1065  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
1066  ret i1 %b
1067}
1068
1069define i1 @icmp_v4i64_v4i1(<4 x i64>) {
1070; SSE2-LABEL: icmp_v4i64_v4i1:
1071; SSE2:       # %bb.0:
1072; SSE2-NEXT:    pxor %xmm2, %xmm2
1073; SSE2-NEXT:    pcmpeqd %xmm2, %xmm1
1074; SSE2-NEXT:    pcmpeqd %xmm2, %xmm0
1075; SSE2-NEXT:    packssdw %xmm1, %xmm0
1076; SSE2-NEXT:    packsswb %xmm0, %xmm0
1077; SSE2-NEXT:    pmovmskb %xmm0, %eax
1078; SSE2-NEXT:    cmpb $-1, %al
1079; SSE2-NEXT:    sete %al
1080; SSE2-NEXT:    retq
1081;
1082; SSE41-LABEL: icmp_v4i64_v4i1:
1083; SSE41:       # %bb.0:
1084; SSE41-NEXT:    pxor %xmm2, %xmm2
1085; SSE41-NEXT:    pcmpeqq %xmm2, %xmm1
1086; SSE41-NEXT:    pcmpeqq %xmm2, %xmm0
1087; SSE41-NEXT:    packssdw %xmm1, %xmm0
1088; SSE41-NEXT:    movmskps %xmm0, %eax
1089; SSE41-NEXT:    cmpb $15, %al
1090; SSE41-NEXT:    sete %al
1091; SSE41-NEXT:    retq
1092;
1093; AVX1-LABEL: icmp_v4i64_v4i1:
1094; AVX1:       # %bb.0:
1095; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
1096; AVX1-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1097; AVX1-NEXT:    vpcmpeqq %xmm2, %xmm1, %xmm1
1098; AVX1-NEXT:    vpcmpeqq %xmm2, %xmm0, %xmm0
1099; AVX1-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
1100; AVX1-NEXT:    vmovmskpd %ymm0, %eax
1101; AVX1-NEXT:    cmpb $15, %al
1102; AVX1-NEXT:    sete %al
1103; AVX1-NEXT:    vzeroupper
1104; AVX1-NEXT:    retq
1105;
1106; AVX2-LABEL: icmp_v4i64_v4i1:
1107; AVX2:       # %bb.0:
1108; AVX2-NEXT:    vptest %ymm0, %ymm0
1109; AVX2-NEXT:    sete %al
1110; AVX2-NEXT:    vzeroupper
1111; AVX2-NEXT:    retq
1112;
1113; AVX512F-LABEL: icmp_v4i64_v4i1:
1114; AVX512F:       # %bb.0:
1115; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1116; AVX512F-NEXT:    vptestnmq %zmm0, %zmm0, %k0
1117; AVX512F-NEXT:    kmovw %k0, %eax
1118; AVX512F-NEXT:    andb $15, %al
1119; AVX512F-NEXT:    cmpb $15, %al
1120; AVX512F-NEXT:    sete %al
1121; AVX512F-NEXT:    vzeroupper
1122; AVX512F-NEXT:    retq
1123;
1124; AVX512BW-LABEL: icmp_v4i64_v4i1:
1125; AVX512BW:       # %bb.0:
1126; AVX512BW-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1127; AVX512BW-NEXT:    vptestnmq %zmm0, %zmm0, %k0
1128; AVX512BW-NEXT:    kmovd %k0, %eax
1129; AVX512BW-NEXT:    andb $15, %al
1130; AVX512BW-NEXT:    cmpb $15, %al
1131; AVX512BW-NEXT:    sete %al
1132; AVX512BW-NEXT:    vzeroupper
1133; AVX512BW-NEXT:    retq
1134;
1135; AVX512VL-LABEL: icmp_v4i64_v4i1:
1136; AVX512VL:       # %bb.0:
1137; AVX512VL-NEXT:    vptestnmq %ymm0, %ymm0, %k0
1138; AVX512VL-NEXT:    kmovd %k0, %eax
1139; AVX512VL-NEXT:    cmpb $15, %al
1140; AVX512VL-NEXT:    sete %al
1141; AVX512VL-NEXT:    vzeroupper
1142; AVX512VL-NEXT:    retq
1143  %a = icmp eq <4 x i64> %0, zeroinitializer
1144  %b = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %a)
1145  ret i1 %b
1146}
1147
1148define i1 @icmp_v8i32_v8i1(<8 x i32>) {
1149; SSE-LABEL: icmp_v8i32_v8i1:
1150; SSE:       # %bb.0:
1151; SSE-NEXT:    pxor %xmm2, %xmm2
1152; SSE-NEXT:    pcmpeqd %xmm2, %xmm1
1153; SSE-NEXT:    pcmpeqd %xmm2, %xmm0
1154; SSE-NEXT:    packssdw %xmm1, %xmm0
1155; SSE-NEXT:    packsswb %xmm0, %xmm0
1156; SSE-NEXT:    pmovmskb %xmm0, %eax
1157; SSE-NEXT:    cmpb $-1, %al
1158; SSE-NEXT:    sete %al
1159; SSE-NEXT:    retq
1160;
1161; AVX1-LABEL: icmp_v8i32_v8i1:
1162; AVX1:       # %bb.0:
1163; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
1164; AVX1-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1165; AVX1-NEXT:    vpcmpeqd %xmm2, %xmm1, %xmm1
1166; AVX1-NEXT:    vpcmpeqd %xmm2, %xmm0, %xmm0
1167; AVX1-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
1168; AVX1-NEXT:    vmovmskps %ymm0, %eax
1169; AVX1-NEXT:    cmpb $-1, %al
1170; AVX1-NEXT:    sete %al
1171; AVX1-NEXT:    vzeroupper
1172; AVX1-NEXT:    retq
1173;
1174; AVX2-LABEL: icmp_v8i32_v8i1:
1175; AVX2:       # %bb.0:
1176; AVX2-NEXT:    vptest %ymm0, %ymm0
1177; AVX2-NEXT:    sete %al
1178; AVX2-NEXT:    vzeroupper
1179; AVX2-NEXT:    retq
1180;
1181; AVX512F-LABEL: icmp_v8i32_v8i1:
1182; AVX512F:       # %bb.0:
1183; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1184; AVX512F-NEXT:    vptestnmd %zmm0, %zmm0, %k0
1185; AVX512F-NEXT:    kmovw %k0, %eax
1186; AVX512F-NEXT:    cmpb $-1, %al
1187; AVX512F-NEXT:    sete %al
1188; AVX512F-NEXT:    vzeroupper
1189; AVX512F-NEXT:    retq
1190;
1191; AVX512BW-LABEL: icmp_v8i32_v8i1:
1192; AVX512BW:       # %bb.0:
1193; AVX512BW-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1194; AVX512BW-NEXT:    vptestnmd %zmm0, %zmm0, %k0
1195; AVX512BW-NEXT:    kmovd %k0, %eax
1196; AVX512BW-NEXT:    cmpb $-1, %al
1197; AVX512BW-NEXT:    sete %al
1198; AVX512BW-NEXT:    vzeroupper
1199; AVX512BW-NEXT:    retq
1200;
1201; AVX512VL-LABEL: icmp_v8i32_v8i1:
1202; AVX512VL:       # %bb.0:
1203; AVX512VL-NEXT:    vptestnmd %ymm0, %ymm0, %k0
1204; AVX512VL-NEXT:    kmovd %k0, %eax
1205; AVX512VL-NEXT:    cmpb $-1, %al
1206; AVX512VL-NEXT:    sete %al
1207; AVX512VL-NEXT:    vzeroupper
1208; AVX512VL-NEXT:    retq
1209  %a = icmp eq <8 x i32> %0, zeroinitializer
1210  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
1211  ret i1 %b
1212}
1213
1214define i1 @icmp_v16i16_v16i1(<16 x i16>) {
1215; SSE-LABEL: icmp_v16i16_v16i1:
1216; SSE:       # %bb.0:
1217; SSE-NEXT:    pxor %xmm2, %xmm2
1218; SSE-NEXT:    pcmpeqw %xmm2, %xmm1
1219; SSE-NEXT:    pcmpeqw %xmm2, %xmm0
1220; SSE-NEXT:    packsswb %xmm1, %xmm0
1221; SSE-NEXT:    pmovmskb %xmm0, %eax
1222; SSE-NEXT:    cmpw $-1, %ax
1223; SSE-NEXT:    sete %al
1224; SSE-NEXT:    retq
1225;
1226; AVX1-LABEL: icmp_v16i16_v16i1:
1227; AVX1:       # %bb.0:
1228; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
1229; AVX1-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1230; AVX1-NEXT:    vpcmpeqw %xmm2, %xmm1, %xmm1
1231; AVX1-NEXT:    vpcmpeqw %xmm2, %xmm0, %xmm0
1232; AVX1-NEXT:    vpacksswb %xmm1, %xmm0, %xmm0
1233; AVX1-NEXT:    vpmovmskb %xmm0, %eax
1234; AVX1-NEXT:    cmpw $-1, %ax
1235; AVX1-NEXT:    sete %al
1236; AVX1-NEXT:    vzeroupper
1237; AVX1-NEXT:    retq
1238;
1239; AVX2-LABEL: icmp_v16i16_v16i1:
1240; AVX2:       # %bb.0:
1241; AVX2-NEXT:    vpxor %xmm1, %xmm1, %xmm1
1242; AVX2-NEXT:    vpcmpeqw %ymm1, %ymm0, %ymm0
1243; AVX2-NEXT:    vpmovmskb %ymm0, %eax
1244; AVX2-NEXT:    cmpl $-1, %eax
1245; AVX2-NEXT:    sete %al
1246; AVX2-NEXT:    vzeroupper
1247; AVX2-NEXT:    retq
1248;
1249; AVX512F-LABEL: icmp_v16i16_v16i1:
1250; AVX512F:       # %bb.0:
1251; AVX512F-NEXT:    vpxor %xmm1, %xmm1, %xmm1
1252; AVX512F-NEXT:    vpcmpeqw %ymm1, %ymm0, %ymm0
1253; AVX512F-NEXT:    vpmovsxwd %ymm0, %zmm0
1254; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
1255; AVX512F-NEXT:    kortestw %k0, %k0
1256; AVX512F-NEXT:    setb %al
1257; AVX512F-NEXT:    vzeroupper
1258; AVX512F-NEXT:    retq
1259;
1260; AVX512BW-LABEL: icmp_v16i16_v16i1:
1261; AVX512BW:       # %bb.0:
1262; AVX512BW-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1263; AVX512BW-NEXT:    vptestnmw %zmm0, %zmm0, %k0
1264; AVX512BW-NEXT:    kortestw %k0, %k0
1265; AVX512BW-NEXT:    setb %al
1266; AVX512BW-NEXT:    vzeroupper
1267; AVX512BW-NEXT:    retq
1268;
1269; AVX512VL-LABEL: icmp_v16i16_v16i1:
1270; AVX512VL:       # %bb.0:
1271; AVX512VL-NEXT:    vptestnmw %ymm0, %ymm0, %k0
1272; AVX512VL-NEXT:    kortestw %k0, %k0
1273; AVX512VL-NEXT:    setb %al
1274; AVX512VL-NEXT:    vzeroupper
1275; AVX512VL-NEXT:    retq
1276  %a = icmp eq <16 x i16> %0, zeroinitializer
1277  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
1278  ret i1 %b
1279}
1280
1281define i1 @icmp_v32i8_v32i1(<32 x i8>) {
1282; SSE2-LABEL: icmp_v32i8_v32i1:
1283; SSE2:       # %bb.0:
1284; SSE2-NEXT:    por %xmm1, %xmm0
1285; SSE2-NEXT:    pxor %xmm1, %xmm1
1286; SSE2-NEXT:    pcmpeqb %xmm0, %xmm1
1287; SSE2-NEXT:    pmovmskb %xmm1, %eax
1288; SSE2-NEXT:    cmpw $-1, %ax
1289; SSE2-NEXT:    sete %al
1290; SSE2-NEXT:    retq
1291;
1292; SSE41-LABEL: icmp_v32i8_v32i1:
1293; SSE41:       # %bb.0:
1294; SSE41-NEXT:    por %xmm1, %xmm0
1295; SSE41-NEXT:    ptest %xmm0, %xmm0
1296; SSE41-NEXT:    sete %al
1297; SSE41-NEXT:    retq
1298;
1299; AVX1-LABEL: icmp_v32i8_v32i1:
1300; AVX1:       # %bb.0:
1301; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
1302; AVX1-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1303; AVX1-NEXT:    vpcmpeqb %xmm2, %xmm1, %xmm1
1304; AVX1-NEXT:    vpcmpeqb %xmm2, %xmm0, %xmm0
1305; AVX1-NEXT:    vpand %xmm1, %xmm0, %xmm0
1306; AVX1-NEXT:    vpmovmskb %xmm0, %eax
1307; AVX1-NEXT:    cmpw $-1, %ax
1308; AVX1-NEXT:    sete %al
1309; AVX1-NEXT:    vzeroupper
1310; AVX1-NEXT:    retq
1311;
1312; AVX2-LABEL: icmp_v32i8_v32i1:
1313; AVX2:       # %bb.0:
1314; AVX2-NEXT:    vptest %ymm0, %ymm0
1315; AVX2-NEXT:    sete %al
1316; AVX2-NEXT:    vzeroupper
1317; AVX2-NEXT:    retq
1318;
1319; AVX512F-LABEL: icmp_v32i8_v32i1:
1320; AVX512F:       # %bb.0:
1321; AVX512F-NEXT:    vpxor %xmm1, %xmm1, %xmm1
1322; AVX512F-NEXT:    vpcmpeqb %ymm1, %ymm0, %ymm0
1323; AVX512F-NEXT:    vextracti128 $1, %ymm0, %xmm1
1324; AVX512F-NEXT:    vpand %xmm1, %xmm0, %xmm0
1325; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
1326; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
1327; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
1328; AVX512F-NEXT:    kandw %k1, %k0, %k0
1329; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
1330; AVX512F-NEXT:    kandw %k1, %k0, %k0
1331; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
1332; AVX512F-NEXT:    kandw %k1, %k0, %k0
1333; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
1334; AVX512F-NEXT:    kandw %k1, %k0, %k0
1335; AVX512F-NEXT:    kmovw %k0, %eax
1336; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
1337; AVX512F-NEXT:    vzeroupper
1338; AVX512F-NEXT:    retq
1339;
1340; AVX512BW-LABEL: icmp_v32i8_v32i1:
1341; AVX512BW:       # %bb.0:
1342; AVX512BW-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
1343; AVX512BW-NEXT:    vptestnmb %zmm0, %zmm0, %k0
1344; AVX512BW-NEXT:    kortestd %k0, %k0
1345; AVX512BW-NEXT:    setb %al
1346; AVX512BW-NEXT:    vzeroupper
1347; AVX512BW-NEXT:    retq
1348;
1349; AVX512VL-LABEL: icmp_v32i8_v32i1:
1350; AVX512VL:       # %bb.0:
1351; AVX512VL-NEXT:    vptestnmb %ymm0, %ymm0, %k0
1352; AVX512VL-NEXT:    kortestd %k0, %k0
1353; AVX512VL-NEXT:    setb %al
1354; AVX512VL-NEXT:    vzeroupper
1355; AVX512VL-NEXT:    retq
1356  %a = icmp eq <32 x i8> %0, zeroinitializer
1357  %b = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> %a)
1358  ret i1 %b
1359}
1360
1361define i1 @icmp_v8i64_v8i1(<8 x i64>) {
1362; SSE2-LABEL: icmp_v8i64_v8i1:
1363; SSE2:       # %bb.0:
1364; SSE2-NEXT:    pxor %xmm4, %xmm4
1365; SSE2-NEXT:    pcmpeqd %xmm4, %xmm3
1366; SSE2-NEXT:    pcmpeqd %xmm4, %xmm2
1367; SSE2-NEXT:    packssdw %xmm3, %xmm2
1368; SSE2-NEXT:    pcmpeqd %xmm4, %xmm1
1369; SSE2-NEXT:    pcmpeqd %xmm4, %xmm0
1370; SSE2-NEXT:    packssdw %xmm1, %xmm0
1371; SSE2-NEXT:    packsswb %xmm2, %xmm0
1372; SSE2-NEXT:    pmovmskb %xmm0, %eax
1373; SSE2-NEXT:    cmpw $-1, %ax
1374; SSE2-NEXT:    sete %al
1375; SSE2-NEXT:    retq
1376;
1377; SSE41-LABEL: icmp_v8i64_v8i1:
1378; SSE41:       # %bb.0:
1379; SSE41-NEXT:    pxor %xmm4, %xmm4
1380; SSE41-NEXT:    pcmpeqq %xmm4, %xmm3
1381; SSE41-NEXT:    pcmpeqq %xmm4, %xmm2
1382; SSE41-NEXT:    packssdw %xmm3, %xmm2
1383; SSE41-NEXT:    pcmpeqq %xmm4, %xmm1
1384; SSE41-NEXT:    pcmpeqq %xmm4, %xmm0
1385; SSE41-NEXT:    packssdw %xmm1, %xmm0
1386; SSE41-NEXT:    packssdw %xmm2, %xmm0
1387; SSE41-NEXT:    packsswb %xmm0, %xmm0
1388; SSE41-NEXT:    pmovmskb %xmm0, %eax
1389; SSE41-NEXT:    cmpb $-1, %al
1390; SSE41-NEXT:    sete %al
1391; SSE41-NEXT:    retq
1392;
1393; AVX1-LABEL: icmp_v8i64_v8i1:
1394; AVX1:       # %bb.0:
1395; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2
1396; AVX1-NEXT:    vpxor %xmm3, %xmm3, %xmm3
1397; AVX1-NEXT:    vpcmpeqq %xmm3, %xmm2, %xmm2
1398; AVX1-NEXT:    vpcmpeqq %xmm3, %xmm1, %xmm1
1399; AVX1-NEXT:    vpackssdw %xmm2, %xmm1, %xmm1
1400; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm2
1401; AVX1-NEXT:    vpcmpeqq %xmm3, %xmm2, %xmm2
1402; AVX1-NEXT:    vpcmpeqq %xmm3, %xmm0, %xmm0
1403; AVX1-NEXT:    vpackssdw %xmm2, %xmm0, %xmm0
1404; AVX1-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
1405; AVX1-NEXT:    vmovmskps %ymm0, %eax
1406; AVX1-NEXT:    cmpb $-1, %al
1407; AVX1-NEXT:    sete %al
1408; AVX1-NEXT:    vzeroupper
1409; AVX1-NEXT:    retq
1410;
1411; AVX2-LABEL: icmp_v8i64_v8i1:
1412; AVX2:       # %bb.0:
1413; AVX2-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1414; AVX2-NEXT:    vpcmpeqq %ymm2, %ymm1, %ymm1
1415; AVX2-NEXT:    vpcmpeqq %ymm2, %ymm0, %ymm0
1416; AVX2-NEXT:    vpackssdw %ymm1, %ymm0, %ymm0
1417; AVX2-NEXT:    vmovmskps %ymm0, %eax
1418; AVX2-NEXT:    cmpb $-1, %al
1419; AVX2-NEXT:    sete %al
1420; AVX2-NEXT:    vzeroupper
1421; AVX2-NEXT:    retq
1422;
1423; AVX512F-LABEL: icmp_v8i64_v8i1:
1424; AVX512F:       # %bb.0:
1425; AVX512F-NEXT:    vptestnmq %zmm0, %zmm0, %k0
1426; AVX512F-NEXT:    kmovw %k0, %eax
1427; AVX512F-NEXT:    cmpb $-1, %al
1428; AVX512F-NEXT:    sete %al
1429; AVX512F-NEXT:    vzeroupper
1430; AVX512F-NEXT:    retq
1431;
1432; AVX512BW-LABEL: icmp_v8i64_v8i1:
1433; AVX512BW:       # %bb.0:
1434; AVX512BW-NEXT:    vptestnmq %zmm0, %zmm0, %k0
1435; AVX512BW-NEXT:    kmovd %k0, %eax
1436; AVX512BW-NEXT:    cmpb $-1, %al
1437; AVX512BW-NEXT:    sete %al
1438; AVX512BW-NEXT:    vzeroupper
1439; AVX512BW-NEXT:    retq
1440;
1441; AVX512VL-LABEL: icmp_v8i64_v8i1:
1442; AVX512VL:       # %bb.0:
1443; AVX512VL-NEXT:    vptestnmq %zmm0, %zmm0, %k0
1444; AVX512VL-NEXT:    kmovd %k0, %eax
1445; AVX512VL-NEXT:    cmpb $-1, %al
1446; AVX512VL-NEXT:    sete %al
1447; AVX512VL-NEXT:    vzeroupper
1448; AVX512VL-NEXT:    retq
1449  %a = icmp eq <8 x i64> %0, zeroinitializer
1450  %b = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %a)
1451  ret i1 %b
1452}
1453
1454define i1 @icmp_v16i32_v16i1(<16 x i32>) {
1455; SSE-LABEL: icmp_v16i32_v16i1:
1456; SSE:       # %bb.0:
1457; SSE-NEXT:    pxor %xmm4, %xmm4
1458; SSE-NEXT:    pcmpeqd %xmm4, %xmm3
1459; SSE-NEXT:    pcmpeqd %xmm4, %xmm2
1460; SSE-NEXT:    packssdw %xmm3, %xmm2
1461; SSE-NEXT:    pcmpeqd %xmm4, %xmm1
1462; SSE-NEXT:    pcmpeqd %xmm4, %xmm0
1463; SSE-NEXT:    packssdw %xmm1, %xmm0
1464; SSE-NEXT:    packsswb %xmm2, %xmm0
1465; SSE-NEXT:    pmovmskb %xmm0, %eax
1466; SSE-NEXT:    cmpw $-1, %ax
1467; SSE-NEXT:    sete %al
1468; SSE-NEXT:    retq
1469;
1470; AVX1-LABEL: icmp_v16i32_v16i1:
1471; AVX1:       # %bb.0:
1472; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2
1473; AVX1-NEXT:    vpxor %xmm3, %xmm3, %xmm3
1474; AVX1-NEXT:    vpcmpeqd %xmm3, %xmm2, %xmm2
1475; AVX1-NEXT:    vpcmpeqd %xmm3, %xmm1, %xmm1
1476; AVX1-NEXT:    vpackssdw %xmm2, %xmm1, %xmm1
1477; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm2
1478; AVX1-NEXT:    vpcmpeqd %xmm3, %xmm2, %xmm2
1479; AVX1-NEXT:    vpcmpeqd %xmm3, %xmm0, %xmm0
1480; AVX1-NEXT:    vpackssdw %xmm2, %xmm0, %xmm0
1481; AVX1-NEXT:    vpacksswb %xmm1, %xmm0, %xmm0
1482; AVX1-NEXT:    vpmovmskb %xmm0, %eax
1483; AVX1-NEXT:    cmpw $-1, %ax
1484; AVX1-NEXT:    sete %al
1485; AVX1-NEXT:    vzeroupper
1486; AVX1-NEXT:    retq
1487;
1488; AVX2-LABEL: icmp_v16i32_v16i1:
1489; AVX2:       # %bb.0:
1490; AVX2-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1491; AVX2-NEXT:    vpcmpeqd %ymm2, %ymm1, %ymm1
1492; AVX2-NEXT:    vpcmpeqd %ymm2, %ymm0, %ymm0
1493; AVX2-NEXT:    vpackssdw %ymm1, %ymm0, %ymm0
1494; AVX2-NEXT:    vextracti128 $1, %ymm0, %xmm1
1495; AVX2-NEXT:    vpacksswb %xmm1, %xmm0, %xmm0
1496; AVX2-NEXT:    vpmovmskb %xmm0, %eax
1497; AVX2-NEXT:    cmpw $-1, %ax
1498; AVX2-NEXT:    sete %al
1499; AVX2-NEXT:    vzeroupper
1500; AVX2-NEXT:    retq
1501;
1502; AVX512-LABEL: icmp_v16i32_v16i1:
1503; AVX512:       # %bb.0:
1504; AVX512-NEXT:    vptestnmd %zmm0, %zmm0, %k0
1505; AVX512-NEXT:    kortestw %k0, %k0
1506; AVX512-NEXT:    setb %al
1507; AVX512-NEXT:    vzeroupper
1508; AVX512-NEXT:    retq
1509  %a = icmp eq <16 x i32> %0, zeroinitializer
1510  %b = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %a)
1511  ret i1 %b
1512}
1513
1514define i1 @icmp_v32i16_v32i1(<32 x i16>) {
1515; SSE-LABEL: icmp_v32i16_v32i1:
1516; SSE:       # %bb.0:
1517; SSE-NEXT:    pxor %xmm4, %xmm4
1518; SSE-NEXT:    pcmpeqw %xmm4, %xmm1
1519; SSE-NEXT:    pcmpeqw %xmm4, %xmm0
1520; SSE-NEXT:    packsswb %xmm1, %xmm0
1521; SSE-NEXT:    pcmpeqw %xmm4, %xmm3
1522; SSE-NEXT:    pcmpeqw %xmm4, %xmm2
1523; SSE-NEXT:    packsswb %xmm3, %xmm2
1524; SSE-NEXT:    pand %xmm0, %xmm2
1525; SSE-NEXT:    pmovmskb %xmm2, %eax
1526; SSE-NEXT:    cmpw $-1, %ax
1527; SSE-NEXT:    sete %al
1528; SSE-NEXT:    retq
1529;
1530; AVX1-LABEL: icmp_v32i16_v32i1:
1531; AVX1:       # %bb.0:
1532; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2
1533; AVX1-NEXT:    vpxor %xmm3, %xmm3, %xmm3
1534; AVX1-NEXT:    vpcmpeqw %xmm3, %xmm2, %xmm2
1535; AVX1-NEXT:    vpcmpeqw %xmm3, %xmm1, %xmm1
1536; AVX1-NEXT:    vpacksswb %xmm2, %xmm1, %xmm1
1537; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm2
1538; AVX1-NEXT:    vpcmpeqw %xmm3, %xmm2, %xmm2
1539; AVX1-NEXT:    vpcmpeqw %xmm3, %xmm0, %xmm0
1540; AVX1-NEXT:    vpacksswb %xmm2, %xmm0, %xmm0
1541; AVX1-NEXT:    vpand %xmm1, %xmm0, %xmm0
1542; AVX1-NEXT:    vpmovmskb %xmm0, %eax
1543; AVX1-NEXT:    cmpw $-1, %ax
1544; AVX1-NEXT:    sete %al
1545; AVX1-NEXT:    vzeroupper
1546; AVX1-NEXT:    retq
1547;
1548; AVX2-LABEL: icmp_v32i16_v32i1:
1549; AVX2:       # %bb.0:
1550; AVX2-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1551; AVX2-NEXT:    vpcmpeqw %ymm2, %ymm1, %ymm1
1552; AVX2-NEXT:    vpcmpeqw %ymm2, %ymm0, %ymm0
1553; AVX2-NEXT:    vpacksswb %ymm1, %ymm0, %ymm0
1554; AVX2-NEXT:    vpmovmskb %ymm0, %eax
1555; AVX2-NEXT:    cmpl $-1, %eax
1556; AVX2-NEXT:    sete %al
1557; AVX2-NEXT:    vzeroupper
1558; AVX2-NEXT:    retq
1559;
1560; AVX512F-LABEL: icmp_v32i16_v32i1:
1561; AVX512F:       # %bb.0:
1562; AVX512F-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1563; AVX512F-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1564; AVX512F-NEXT:    vpcmpeqw %ymm2, %ymm1, %ymm1
1565; AVX512F-NEXT:    vpcmpeqw %ymm2, %ymm0, %ymm0
1566; AVX512F-NEXT:    vpand %ymm1, %ymm0, %ymm0
1567; AVX512F-NEXT:    vpmovsxwd %ymm0, %zmm0
1568; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
1569; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
1570; AVX512F-NEXT:    kandw %k1, %k0, %k0
1571; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
1572; AVX512F-NEXT:    kandw %k1, %k0, %k0
1573; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
1574; AVX512F-NEXT:    kandw %k1, %k0, %k0
1575; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
1576; AVX512F-NEXT:    kandw %k1, %k0, %k0
1577; AVX512F-NEXT:    kmovw %k0, %eax
1578; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
1579; AVX512F-NEXT:    vzeroupper
1580; AVX512F-NEXT:    retq
1581;
1582; AVX512BW-LABEL: icmp_v32i16_v32i1:
1583; AVX512BW:       # %bb.0:
1584; AVX512BW-NEXT:    vptestnmw %zmm0, %zmm0, %k0
1585; AVX512BW-NEXT:    kortestd %k0, %k0
1586; AVX512BW-NEXT:    setb %al
1587; AVX512BW-NEXT:    vzeroupper
1588; AVX512BW-NEXT:    retq
1589;
1590; AVX512VL-LABEL: icmp_v32i16_v32i1:
1591; AVX512VL:       # %bb.0:
1592; AVX512VL-NEXT:    vptestnmw %zmm0, %zmm0, %k0
1593; AVX512VL-NEXT:    kortestd %k0, %k0
1594; AVX512VL-NEXT:    setb %al
1595; AVX512VL-NEXT:    vzeroupper
1596; AVX512VL-NEXT:    retq
1597  %a = icmp eq <32 x i16> %0, zeroinitializer
1598  %b = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> %a)
1599  ret i1 %b
1600}
1601
1602define i1 @icmp_v64i8_v64i1(<64 x i8>) {
1603; SSE2-LABEL: icmp_v64i8_v64i1:
1604; SSE2:       # %bb.0:
1605; SSE2-NEXT:    por %xmm3, %xmm1
1606; SSE2-NEXT:    pxor %xmm3, %xmm3
1607; SSE2-NEXT:    por %xmm2, %xmm1
1608; SSE2-NEXT:    por %xmm0, %xmm1
1609; SSE2-NEXT:    pcmpeqb %xmm3, %xmm1
1610; SSE2-NEXT:    pmovmskb %xmm1, %eax
1611; SSE2-NEXT:    cmpw $-1, %ax
1612; SSE2-NEXT:    sete %al
1613; SSE2-NEXT:    retq
1614;
1615; SSE41-LABEL: icmp_v64i8_v64i1:
1616; SSE41:       # %bb.0:
1617; SSE41-NEXT:    por %xmm3, %xmm1
1618; SSE41-NEXT:    por %xmm2, %xmm1
1619; SSE41-NEXT:    por %xmm0, %xmm1
1620; SSE41-NEXT:    ptest %xmm1, %xmm1
1621; SSE41-NEXT:    sete %al
1622; SSE41-NEXT:    retq
1623;
1624; AVX1-LABEL: icmp_v64i8_v64i1:
1625; AVX1:       # %bb.0:
1626; AVX1-NEXT:    vorps %ymm1, %ymm0, %ymm0
1627; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm1
1628; AVX1-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1629; AVX1-NEXT:    vpcmpeqb %xmm2, %xmm1, %xmm1
1630; AVX1-NEXT:    vpcmpeqb %xmm2, %xmm0, %xmm0
1631; AVX1-NEXT:    vpand %xmm1, %xmm0, %xmm0
1632; AVX1-NEXT:    vpmovmskb %xmm0, %eax
1633; AVX1-NEXT:    cmpw $-1, %ax
1634; AVX1-NEXT:    sete %al
1635; AVX1-NEXT:    vzeroupper
1636; AVX1-NEXT:    retq
1637;
1638; AVX2-LABEL: icmp_v64i8_v64i1:
1639; AVX2:       # %bb.0:
1640; AVX2-NEXT:    vpor %ymm1, %ymm0, %ymm0
1641; AVX2-NEXT:    vptest %ymm0, %ymm0
1642; AVX2-NEXT:    sete %al
1643; AVX2-NEXT:    vzeroupper
1644; AVX2-NEXT:    retq
1645;
1646; AVX512F-LABEL: icmp_v64i8_v64i1:
1647; AVX512F:       # %bb.0:
1648; AVX512F-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1649; AVX512F-NEXT:    vpxor %xmm2, %xmm2, %xmm2
1650; AVX512F-NEXT:    vpcmpeqb %ymm2, %ymm1, %ymm1
1651; AVX512F-NEXT:    vpcmpeqb %ymm2, %ymm0, %ymm0
1652; AVX512F-NEXT:    vextracti128 $1, %ymm1, %xmm2
1653; AVX512F-NEXT:    vextracti128 $1, %ymm0, %xmm3
1654; AVX512F-NEXT:    vpand %xmm2, %xmm3, %xmm2
1655; AVX512F-NEXT:    vpand %xmm2, %xmm1, %xmm1
1656; AVX512F-NEXT:    vpand %xmm1, %xmm0, %xmm0
1657; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
1658; AVX512F-NEXT:    vpslld $31, %zmm0, %zmm0
1659; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0
1660; AVX512F-NEXT:    kshiftrw $8, %k0, %k1
1661; AVX512F-NEXT:    kandw %k1, %k0, %k0
1662; AVX512F-NEXT:    kshiftrw $4, %k0, %k1
1663; AVX512F-NEXT:    kandw %k1, %k0, %k0
1664; AVX512F-NEXT:    kshiftrw $2, %k0, %k1
1665; AVX512F-NEXT:    kandw %k1, %k0, %k0
1666; AVX512F-NEXT:    kshiftrw $1, %k0, %k1
1667; AVX512F-NEXT:    kandw %k1, %k0, %k0
1668; AVX512F-NEXT:    kmovw %k0, %eax
1669; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
1670; AVX512F-NEXT:    vzeroupper
1671; AVX512F-NEXT:    retq
1672;
1673; AVX512BW-LABEL: icmp_v64i8_v64i1:
1674; AVX512BW:       # %bb.0:
1675; AVX512BW-NEXT:    vptestnmb %zmm0, %zmm0, %k0
1676; AVX512BW-NEXT:    kortestq %k0, %k0
1677; AVX512BW-NEXT:    setb %al
1678; AVX512BW-NEXT:    vzeroupper
1679; AVX512BW-NEXT:    retq
1680;
1681; AVX512VL-LABEL: icmp_v64i8_v64i1:
1682; AVX512VL:       # %bb.0:
1683; AVX512VL-NEXT:    vptestnmb %zmm0, %zmm0, %k0
1684; AVX512VL-NEXT:    kortestq %k0, %k0
1685; AVX512VL-NEXT:    setb %al
1686; AVX512VL-NEXT:    vzeroupper
1687; AVX512VL-NEXT:    retq
1688  %a = icmp eq <64 x i8> %0, zeroinitializer
1689  %b = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> %a)
1690  ret i1 %b
1691}
1692
1693declare i1 @llvm.vector.reduce.and.v2i1(<2 x i1>)
1694declare i1 @llvm.vector.reduce.and.v4i1(<4 x i1>)
1695declare i1 @llvm.vector.reduce.and.v8i1(<8 x i1>)
1696declare i1 @llvm.vector.reduce.and.v16i1(<16 x i1>)
1697declare i1 @llvm.vector.reduce.and.v32i1(<32 x i1>)
1698declare i1 @llvm.vector.reduce.and.v64i1(<64 x i1>)
1699