• 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=+avx512vl | FileCheck %s --check-prefix=AVX512VL --check-prefix=AVX512VL-X64
3; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefix=AVX512VL --check-prefix=AVX512VL-X86
4; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=AVX512F --check-prefix=AVX512F-X64
5; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=AVX512F --check-prefix=AVX512F-X86
6
7; Function Attrs: norecurse nounwind readnone
8define zeroext i8 @TEST_mm_test_epi64_mask(<2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
9; AVX512VL-LABEL: TEST_mm_test_epi64_mask:
10; AVX512VL:       # %bb.0: # %entry
11; AVX512VL-NEXT:    vptestmq %xmm0, %xmm1, %k0
12; AVX512VL-NEXT:    kmovw %k0, %eax
13; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
14; AVX512VL-NEXT:    ret{{[l|q]}}
15;
16; AVX512F-LABEL: TEST_mm_test_epi64_mask:
17; AVX512F:       # %bb.0: # %entry
18; AVX512F-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
19; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
20; AVX512F-NEXT:    vptestmq %zmm0, %zmm1, %k0
21; AVX512F-NEXT:    kshiftlw $14, %k0, %k0
22; AVX512F-NEXT:    kshiftrw $14, %k0, %k0
23; AVX512F-NEXT:    kmovw %k0, %eax
24; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
25; AVX512F-NEXT:    vzeroupper
26; AVX512F-NEXT:    ret{{[l|q]}}
27entry:
28  %and.i.i = and <2 x i64> %__B, %__A
29  %0 = icmp ne <2 x i64> %and.i.i, zeroinitializer
30  %1 = shufflevector <2 x i1> %0, <2 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3>
31  %2 = bitcast <8 x i1> %1 to i8
32  ret i8 %2
33}
34
35; Function Attrs: norecurse nounwind readnone
36define zeroext i8 @TEST_mm_test_epi32_mask(<2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
37; AVX512VL-LABEL: TEST_mm_test_epi32_mask:
38; AVX512VL:       # %bb.0: # %entry
39; AVX512VL-NEXT:    vptestmd %xmm0, %xmm1, %k0
40; AVX512VL-NEXT:    kmovw %k0, %eax
41; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
42; AVX512VL-NEXT:    ret{{[l|q]}}
43;
44; AVX512F-LABEL: TEST_mm_test_epi32_mask:
45; AVX512F:       # %bb.0: # %entry
46; AVX512F-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
47; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
48; AVX512F-NEXT:    vptestmd %zmm0, %zmm1, %k0
49; AVX512F-NEXT:    kshiftlw $12, %k0, %k0
50; AVX512F-NEXT:    kshiftrw $12, %k0, %k0
51; AVX512F-NEXT:    kmovw %k0, %eax
52; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
53; AVX512F-NEXT:    vzeroupper
54; AVX512F-NEXT:    ret{{[l|q]}}
55entry:
56  %and.i.i = and <2 x i64> %__B, %__A
57  %0 = bitcast <2 x i64> %and.i.i to <4 x i32>
58  %1 = icmp ne <4 x i32> %0, zeroinitializer
59  %2 = shufflevector <4 x i1> %1, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
60  %3 = bitcast <8 x i1> %2 to i8
61  ret i8 %3
62}
63
64; Function Attrs: norecurse nounwind readnone
65define zeroext i8 @TEST_mm256_test_epi64_mask(<4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
66; AVX512VL-LABEL: TEST_mm256_test_epi64_mask:
67; AVX512VL:       # %bb.0: # %entry
68; AVX512VL-NEXT:    vptestmq %ymm0, %ymm1, %k0
69; AVX512VL-NEXT:    kmovw %k0, %eax
70; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
71; AVX512VL-NEXT:    vzeroupper
72; AVX512VL-NEXT:    ret{{[l|q]}}
73;
74; AVX512F-LABEL: TEST_mm256_test_epi64_mask:
75; AVX512F:       # %bb.0: # %entry
76; AVX512F-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
77; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
78; AVX512F-NEXT:    vptestmq %zmm0, %zmm1, %k0
79; AVX512F-NEXT:    kshiftlw $12, %k0, %k0
80; AVX512F-NEXT:    kshiftrw $12, %k0, %k0
81; AVX512F-NEXT:    kmovw %k0, %eax
82; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
83; AVX512F-NEXT:    vzeroupper
84; AVX512F-NEXT:    ret{{[l|q]}}
85entry:
86  %and.i.i = and <4 x i64> %__B, %__A
87  %0 = icmp ne <4 x i64> %and.i.i, zeroinitializer
88  %1 = shufflevector <4 x i1> %0, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
89  %2 = bitcast <8 x i1> %1 to i8
90  ret i8 %2
91}
92
93; Function Attrs: norecurse nounwind readnone
94define zeroext i8 @TEST_mm256_test_epi32_mask(<4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
95; AVX512VL-LABEL: TEST_mm256_test_epi32_mask:
96; AVX512VL:       # %bb.0: # %entry
97; AVX512VL-NEXT:    vptestmd %ymm0, %ymm1, %k0
98; AVX512VL-NEXT:    kmovw %k0, %eax
99; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
100; AVX512VL-NEXT:    vzeroupper
101; AVX512VL-NEXT:    ret{{[l|q]}}
102;
103; AVX512F-LABEL: TEST_mm256_test_epi32_mask:
104; AVX512F:       # %bb.0: # %entry
105; AVX512F-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
106; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
107; AVX512F-NEXT:    vptestmd %zmm0, %zmm1, %k0
108; AVX512F-NEXT:    kmovw %k0, %eax
109; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
110; AVX512F-NEXT:    vzeroupper
111; AVX512F-NEXT:    ret{{[l|q]}}
112entry:
113  %and.i.i = and <4 x i64> %__B, %__A
114  %0 = bitcast <4 x i64> %and.i.i to <8 x i32>
115  %1 = icmp ne <8 x i32> %0, zeroinitializer
116  %2 = bitcast <8 x i1> %1 to i8
117  ret i8 %2
118}
119
120; Function Attrs: norecurse nounwind readnone
121define zeroext i8 @TEST_mm_mask_test_epi64_mask(i8 %__U, <2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
122; AVX512VL-X64-LABEL: TEST_mm_mask_test_epi64_mask:
123; AVX512VL-X64:       # %bb.0: # %entry
124; AVX512VL-X64-NEXT:    kmovw %edi, %k1
125; AVX512VL-X64-NEXT:    vptestmq %xmm0, %xmm1, %k0 {%k1}
126; AVX512VL-X64-NEXT:    kmovw %k0, %eax
127; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
128; AVX512VL-X64-NEXT:    retq
129;
130; AVX512VL-X86-LABEL: TEST_mm_mask_test_epi64_mask:
131; AVX512VL-X86:       # %bb.0: # %entry
132; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
133; AVX512VL-X86-NEXT:    kmovw %eax, %k1
134; AVX512VL-X86-NEXT:    vptestmq %xmm0, %xmm1, %k0 {%k1}
135; AVX512VL-X86-NEXT:    kmovw %k0, %eax
136; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
137; AVX512VL-X86-NEXT:    retl
138;
139; AVX512F-X64-LABEL: TEST_mm_mask_test_epi64_mask:
140; AVX512F-X64:       # %bb.0: # %entry
141; AVX512F-X64-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
142; AVX512F-X64-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
143; AVX512F-X64-NEXT:    kmovw %edi, %k1
144; AVX512F-X64-NEXT:    vptestmq %zmm0, %zmm1, %k0 {%k1}
145; AVX512F-X64-NEXT:    kshiftlw $14, %k0, %k0
146; AVX512F-X64-NEXT:    kshiftrw $14, %k0, %k0
147; AVX512F-X64-NEXT:    kmovw %k0, %eax
148; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
149; AVX512F-X64-NEXT:    vzeroupper
150; AVX512F-X64-NEXT:    retq
151;
152; AVX512F-X86-LABEL: TEST_mm_mask_test_epi64_mask:
153; AVX512F-X86:       # %bb.0: # %entry
154; AVX512F-X86-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
155; AVX512F-X86-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
156; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
157; AVX512F-X86-NEXT:    kmovw %eax, %k1
158; AVX512F-X86-NEXT:    vptestmq %zmm0, %zmm1, %k0 {%k1}
159; AVX512F-X86-NEXT:    kshiftlw $14, %k0, %k0
160; AVX512F-X86-NEXT:    kshiftrw $14, %k0, %k0
161; AVX512F-X86-NEXT:    kmovw %k0, %eax
162; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
163; AVX512F-X86-NEXT:    vzeroupper
164; AVX512F-X86-NEXT:    retl
165entry:
166  %and.i.i = and <2 x i64> %__B, %__A
167  %0 = icmp ne <2 x i64> %and.i.i, zeroinitializer
168  %1 = bitcast i8 %__U to <8 x i1>
169  %2 = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> <i32 0, i32 1>
170  %3 = and <2 x i1> %0, %2
171  %4 = shufflevector <2 x i1> %3, <2 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3>
172  %5 = bitcast <8 x i1> %4 to i8
173  ret i8 %5
174}
175
176; Function Attrs: norecurse nounwind readnone
177define zeroext i8 @TEST_mm_mask_test_epi32_mask(i8 %__U, <2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
178; AVX512VL-X64-LABEL: TEST_mm_mask_test_epi32_mask:
179; AVX512VL-X64:       # %bb.0: # %entry
180; AVX512VL-X64-NEXT:    kmovw %edi, %k1
181; AVX512VL-X64-NEXT:    vptestmd %xmm0, %xmm1, %k0 {%k1}
182; AVX512VL-X64-NEXT:    kmovw %k0, %eax
183; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
184; AVX512VL-X64-NEXT:    retq
185;
186; AVX512VL-X86-LABEL: TEST_mm_mask_test_epi32_mask:
187; AVX512VL-X86:       # %bb.0: # %entry
188; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
189; AVX512VL-X86-NEXT:    kmovw %eax, %k1
190; AVX512VL-X86-NEXT:    vptestmd %xmm0, %xmm1, %k0 {%k1}
191; AVX512VL-X86-NEXT:    kmovw %k0, %eax
192; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
193; AVX512VL-X86-NEXT:    retl
194;
195; AVX512F-X64-LABEL: TEST_mm_mask_test_epi32_mask:
196; AVX512F-X64:       # %bb.0: # %entry
197; AVX512F-X64-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
198; AVX512F-X64-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
199; AVX512F-X64-NEXT:    kmovw %edi, %k1
200; AVX512F-X64-NEXT:    vptestmd %zmm0, %zmm1, %k0 {%k1}
201; AVX512F-X64-NEXT:    kshiftlw $12, %k0, %k0
202; AVX512F-X64-NEXT:    kshiftrw $12, %k0, %k0
203; AVX512F-X64-NEXT:    kmovw %k0, %eax
204; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
205; AVX512F-X64-NEXT:    vzeroupper
206; AVX512F-X64-NEXT:    retq
207;
208; AVX512F-X86-LABEL: TEST_mm_mask_test_epi32_mask:
209; AVX512F-X86:       # %bb.0: # %entry
210; AVX512F-X86-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
211; AVX512F-X86-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
212; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
213; AVX512F-X86-NEXT:    kmovw %eax, %k1
214; AVX512F-X86-NEXT:    vptestmd %zmm0, %zmm1, %k0 {%k1}
215; AVX512F-X86-NEXT:    kshiftlw $12, %k0, %k0
216; AVX512F-X86-NEXT:    kshiftrw $12, %k0, %k0
217; AVX512F-X86-NEXT:    kmovw %k0, %eax
218; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
219; AVX512F-X86-NEXT:    vzeroupper
220; AVX512F-X86-NEXT:    retl
221entry:
222  %and.i.i = and <2 x i64> %__B, %__A
223  %0 = bitcast <2 x i64> %and.i.i to <4 x i32>
224  %1 = icmp ne <4 x i32> %0, zeroinitializer
225  %2 = bitcast i8 %__U to <8 x i1>
226  %3 = shufflevector <8 x i1> %2, <8 x i1> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
227  %4 = and <4 x i1> %1, %3
228  %5 = shufflevector <4 x i1> %4, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
229  %6 = bitcast <8 x i1> %5 to i8
230  ret i8 %6
231}
232
233
234; Function Attrs: norecurse nounwind readnone
235define zeroext i8 @TEST_mm256_mask_test_epi64_mask(i8 %__U, <4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
236; AVX512VL-X64-LABEL: TEST_mm256_mask_test_epi64_mask:
237; AVX512VL-X64:       # %bb.0: # %entry
238; AVX512VL-X64-NEXT:    kmovw %edi, %k1
239; AVX512VL-X64-NEXT:    vptestmq %ymm0, %ymm1, %k0 {%k1}
240; AVX512VL-X64-NEXT:    kmovw %k0, %eax
241; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
242; AVX512VL-X64-NEXT:    vzeroupper
243; AVX512VL-X64-NEXT:    retq
244;
245; AVX512VL-X86-LABEL: TEST_mm256_mask_test_epi64_mask:
246; AVX512VL-X86:       # %bb.0: # %entry
247; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
248; AVX512VL-X86-NEXT:    kmovw %eax, %k1
249; AVX512VL-X86-NEXT:    vptestmq %ymm0, %ymm1, %k0 {%k1}
250; AVX512VL-X86-NEXT:    kmovw %k0, %eax
251; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
252; AVX512VL-X86-NEXT:    vzeroupper
253; AVX512VL-X86-NEXT:    retl
254;
255; AVX512F-X64-LABEL: TEST_mm256_mask_test_epi64_mask:
256; AVX512F-X64:       # %bb.0: # %entry
257; AVX512F-X64-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
258; AVX512F-X64-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
259; AVX512F-X64-NEXT:    kmovw %edi, %k1
260; AVX512F-X64-NEXT:    vptestmq %zmm0, %zmm1, %k0 {%k1}
261; AVX512F-X64-NEXT:    kshiftlw $12, %k0, %k0
262; AVX512F-X64-NEXT:    kshiftrw $12, %k0, %k0
263; AVX512F-X64-NEXT:    kmovw %k0, %eax
264; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
265; AVX512F-X64-NEXT:    vzeroupper
266; AVX512F-X64-NEXT:    retq
267;
268; AVX512F-X86-LABEL: TEST_mm256_mask_test_epi64_mask:
269; AVX512F-X86:       # %bb.0: # %entry
270; AVX512F-X86-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
271; AVX512F-X86-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
272; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
273; AVX512F-X86-NEXT:    kmovw %eax, %k1
274; AVX512F-X86-NEXT:    vptestmq %zmm0, %zmm1, %k0 {%k1}
275; AVX512F-X86-NEXT:    kshiftlw $12, %k0, %k0
276; AVX512F-X86-NEXT:    kshiftrw $12, %k0, %k0
277; AVX512F-X86-NEXT:    kmovw %k0, %eax
278; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
279; AVX512F-X86-NEXT:    vzeroupper
280; AVX512F-X86-NEXT:    retl
281entry:
282  %and.i.i = and <4 x i64> %__B, %__A
283  %0 = icmp ne <4 x i64> %and.i.i, zeroinitializer
284  %1 = bitcast i8 %__U to <8 x i1>
285  %2 = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
286  %3 = and <4 x i1> %0, %2
287  %4 = shufflevector <4 x i1> %3, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
288  %5 = bitcast <8 x i1> %4 to i8
289  ret i8 %5
290}
291
292; Function Attrs: norecurse nounwind readnone
293define zeroext i8 @TEST_mm256_mask_test_epi32_mask(i8 %__U, <4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
294; AVX512VL-X64-LABEL: TEST_mm256_mask_test_epi32_mask:
295; AVX512VL-X64:       # %bb.0: # %entry
296; AVX512VL-X64-NEXT:    vptestmd %ymm0, %ymm1, %k0
297; AVX512VL-X64-NEXT:    kmovw %k0, %eax
298; AVX512VL-X64-NEXT:    andb %dil, %al
299; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
300; AVX512VL-X64-NEXT:    vzeroupper
301; AVX512VL-X64-NEXT:    retq
302;
303; AVX512VL-X86-LABEL: TEST_mm256_mask_test_epi32_mask:
304; AVX512VL-X86:       # %bb.0: # %entry
305; AVX512VL-X86-NEXT:    vptestmd %ymm0, %ymm1, %k0
306; AVX512VL-X86-NEXT:    kmovw %k0, %eax
307; AVX512VL-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
308; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
309; AVX512VL-X86-NEXT:    vzeroupper
310; AVX512VL-X86-NEXT:    retl
311;
312; AVX512F-X64-LABEL: TEST_mm256_mask_test_epi32_mask:
313; AVX512F-X64:       # %bb.0: # %entry
314; AVX512F-X64-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
315; AVX512F-X64-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
316; AVX512F-X64-NEXT:    vptestmd %zmm0, %zmm1, %k0
317; AVX512F-X64-NEXT:    kmovw %k0, %eax
318; AVX512F-X64-NEXT:    andb %dil, %al
319; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
320; AVX512F-X64-NEXT:    vzeroupper
321; AVX512F-X64-NEXT:    retq
322;
323; AVX512F-X86-LABEL: TEST_mm256_mask_test_epi32_mask:
324; AVX512F-X86:       # %bb.0: # %entry
325; AVX512F-X86-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
326; AVX512F-X86-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
327; AVX512F-X86-NEXT:    vptestmd %zmm0, %zmm1, %k0
328; AVX512F-X86-NEXT:    kmovw %k0, %eax
329; AVX512F-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
330; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
331; AVX512F-X86-NEXT:    vzeroupper
332; AVX512F-X86-NEXT:    retl
333entry:
334  %and.i.i = and <4 x i64> %__B, %__A
335  %0 = bitcast <4 x i64> %and.i.i to <8 x i32>
336  %1 = icmp ne <8 x i32> %0, zeroinitializer
337  %2 = bitcast i8 %__U to <8 x i1>
338  %3 = and <8 x i1> %1, %2
339  %4 = bitcast <8 x i1> %3 to i8
340  ret i8 %4
341}
342
343; Function Attrs: norecurse nounwind readnone
344define zeroext i8 @TEST_mm_testn_epi64_mask(<2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
345; AVX512VL-LABEL: TEST_mm_testn_epi64_mask:
346; AVX512VL:       # %bb.0: # %entry
347; AVX512VL-NEXT:    vptestnmq %xmm0, %xmm1, %k0
348; AVX512VL-NEXT:    kmovw %k0, %eax
349; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
350; AVX512VL-NEXT:    ret{{[l|q]}}
351;
352; AVX512F-LABEL: TEST_mm_testn_epi64_mask:
353; AVX512F:       # %bb.0: # %entry
354; AVX512F-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
355; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
356; AVX512F-NEXT:    vptestnmq %zmm0, %zmm1, %k0
357; AVX512F-NEXT:    kshiftlw $14, %k0, %k0
358; AVX512F-NEXT:    kshiftrw $14, %k0, %k0
359; AVX512F-NEXT:    kmovw %k0, %eax
360; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
361; AVX512F-NEXT:    vzeroupper
362; AVX512F-NEXT:    ret{{[l|q]}}
363entry:
364  %and.i.i = and <2 x i64> %__B, %__A
365  %0 = icmp eq <2 x i64> %and.i.i, zeroinitializer
366  %1 = shufflevector <2 x i1> %0, <2 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3>
367  %2 = bitcast <8 x i1> %1 to i8
368  ret i8 %2
369}
370
371; Function Attrs: norecurse nounwind readnone
372define zeroext i8 @TEST_mm_testn_epi32_mask(<2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
373; AVX512VL-LABEL: TEST_mm_testn_epi32_mask:
374; AVX512VL:       # %bb.0: # %entry
375; AVX512VL-NEXT:    vptestnmd %xmm0, %xmm1, %k0
376; AVX512VL-NEXT:    kmovw %k0, %eax
377; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
378; AVX512VL-NEXT:    ret{{[l|q]}}
379;
380; AVX512F-LABEL: TEST_mm_testn_epi32_mask:
381; AVX512F:       # %bb.0: # %entry
382; AVX512F-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
383; AVX512F-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
384; AVX512F-NEXT:    vptestnmd %zmm0, %zmm1, %k0
385; AVX512F-NEXT:    kshiftlw $12, %k0, %k0
386; AVX512F-NEXT:    kshiftrw $12, %k0, %k0
387; AVX512F-NEXT:    kmovw %k0, %eax
388; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
389; AVX512F-NEXT:    vzeroupper
390; AVX512F-NEXT:    ret{{[l|q]}}
391entry:
392  %and.i.i = and <2 x i64> %__B, %__A
393  %0 = bitcast <2 x i64> %and.i.i to <4 x i32>
394  %1 = icmp eq <4 x i32> %0, zeroinitializer
395  %2 = shufflevector <4 x i1> %1, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
396  %3 = bitcast <8 x i1> %2 to i8
397  ret i8 %3
398}
399
400; Function Attrs: norecurse nounwind readnone
401define zeroext i8 @TEST_mm256_testn_epi64_mask(<4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
402; AVX512VL-LABEL: TEST_mm256_testn_epi64_mask:
403; AVX512VL:       # %bb.0: # %entry
404; AVX512VL-NEXT:    vptestnmq %ymm0, %ymm1, %k0
405; AVX512VL-NEXT:    kmovw %k0, %eax
406; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
407; AVX512VL-NEXT:    vzeroupper
408; AVX512VL-NEXT:    ret{{[l|q]}}
409;
410; AVX512F-LABEL: TEST_mm256_testn_epi64_mask:
411; AVX512F:       # %bb.0: # %entry
412; AVX512F-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
413; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
414; AVX512F-NEXT:    vptestnmq %zmm0, %zmm1, %k0
415; AVX512F-NEXT:    kshiftlw $12, %k0, %k0
416; AVX512F-NEXT:    kshiftrw $12, %k0, %k0
417; AVX512F-NEXT:    kmovw %k0, %eax
418; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
419; AVX512F-NEXT:    vzeroupper
420; AVX512F-NEXT:    ret{{[l|q]}}
421entry:
422  %and.i.i = and <4 x i64> %__B, %__A
423  %0 = icmp eq <4 x i64> %and.i.i, zeroinitializer
424  %1 = shufflevector <4 x i1> %0, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
425  %2 = bitcast <8 x i1> %1 to i8
426  ret i8 %2
427}
428
429; Function Attrs: norecurse nounwind readnone
430define zeroext i8 @TEST_mm256_testn_epi32_mask(<4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
431; AVX512VL-LABEL: TEST_mm256_testn_epi32_mask:
432; AVX512VL:       # %bb.0: # %entry
433; AVX512VL-NEXT:    vptestnmd %ymm0, %ymm1, %k0
434; AVX512VL-NEXT:    kmovw %k0, %eax
435; AVX512VL-NEXT:    # kill: def $al killed $al killed $eax
436; AVX512VL-NEXT:    vzeroupper
437; AVX512VL-NEXT:    ret{{[l|q]}}
438;
439; AVX512F-LABEL: TEST_mm256_testn_epi32_mask:
440; AVX512F:       # %bb.0: # %entry
441; AVX512F-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
442; AVX512F-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
443; AVX512F-NEXT:    vptestnmd %zmm0, %zmm1, %k0
444; AVX512F-NEXT:    kmovw %k0, %eax
445; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
446; AVX512F-NEXT:    vzeroupper
447; AVX512F-NEXT:    ret{{[l|q]}}
448entry:
449  %and.i.i = and <4 x i64> %__B, %__A
450  %0 = bitcast <4 x i64> %and.i.i to <8 x i32>
451  %1 = icmp eq <8 x i32> %0, zeroinitializer
452  %2 = bitcast <8 x i1> %1 to i8
453  ret i8 %2
454}
455
456; Function Attrs: norecurse nounwind readnone
457define zeroext i8 @TEST_mm_mask_testn_epi64_mask(i8 %__U, <2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
458; AVX512VL-X64-LABEL: TEST_mm_mask_testn_epi64_mask:
459; AVX512VL-X64:       # %bb.0: # %entry
460; AVX512VL-X64-NEXT:    kmovw %edi, %k1
461; AVX512VL-X64-NEXT:    vptestnmq %xmm0, %xmm1, %k0 {%k1}
462; AVX512VL-X64-NEXT:    kmovw %k0, %eax
463; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
464; AVX512VL-X64-NEXT:    retq
465;
466; AVX512VL-X86-LABEL: TEST_mm_mask_testn_epi64_mask:
467; AVX512VL-X86:       # %bb.0: # %entry
468; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
469; AVX512VL-X86-NEXT:    kmovw %eax, %k1
470; AVX512VL-X86-NEXT:    vptestnmq %xmm0, %xmm1, %k0 {%k1}
471; AVX512VL-X86-NEXT:    kmovw %k0, %eax
472; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
473; AVX512VL-X86-NEXT:    retl
474;
475; AVX512F-X64-LABEL: TEST_mm_mask_testn_epi64_mask:
476; AVX512F-X64:       # %bb.0: # %entry
477; AVX512F-X64-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
478; AVX512F-X64-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
479; AVX512F-X64-NEXT:    kmovw %edi, %k1
480; AVX512F-X64-NEXT:    vptestnmq %zmm0, %zmm1, %k0 {%k1}
481; AVX512F-X64-NEXT:    kshiftlw $14, %k0, %k0
482; AVX512F-X64-NEXT:    kshiftrw $14, %k0, %k0
483; AVX512F-X64-NEXT:    kmovw %k0, %eax
484; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
485; AVX512F-X64-NEXT:    vzeroupper
486; AVX512F-X64-NEXT:    retq
487;
488; AVX512F-X86-LABEL: TEST_mm_mask_testn_epi64_mask:
489; AVX512F-X86:       # %bb.0: # %entry
490; AVX512F-X86-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
491; AVX512F-X86-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
492; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
493; AVX512F-X86-NEXT:    kmovw %eax, %k1
494; AVX512F-X86-NEXT:    vptestnmq %zmm0, %zmm1, %k0 {%k1}
495; AVX512F-X86-NEXT:    kshiftlw $14, %k0, %k0
496; AVX512F-X86-NEXT:    kshiftrw $14, %k0, %k0
497; AVX512F-X86-NEXT:    kmovw %k0, %eax
498; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
499; AVX512F-X86-NEXT:    vzeroupper
500; AVX512F-X86-NEXT:    retl
501entry:
502  %and.i.i = and <2 x i64> %__B, %__A
503  %0 = icmp eq <2 x i64> %and.i.i, zeroinitializer
504  %1 = bitcast i8 %__U to <8 x i1>
505  %2 = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> <i32 0, i32 1>
506  %3 = and <2 x i1> %0, %2
507  %4 = shufflevector <2 x i1> %3, <2 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3>
508  %5 = bitcast <8 x i1> %4 to i8
509  ret i8 %5
510}
511
512; Function Attrs: norecurse nounwind readnone
513define zeroext i8 @TEST_mm_mask_testn_epi32_mask(i8 %__U, <2 x i64> %__A, <2 x i64> %__B) local_unnamed_addr #0 {
514; AVX512VL-X64-LABEL: TEST_mm_mask_testn_epi32_mask:
515; AVX512VL-X64:       # %bb.0: # %entry
516; AVX512VL-X64-NEXT:    kmovw %edi, %k1
517; AVX512VL-X64-NEXT:    vptestnmd %xmm0, %xmm1, %k0 {%k1}
518; AVX512VL-X64-NEXT:    kmovw %k0, %eax
519; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
520; AVX512VL-X64-NEXT:    retq
521;
522; AVX512VL-X86-LABEL: TEST_mm_mask_testn_epi32_mask:
523; AVX512VL-X86:       # %bb.0: # %entry
524; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
525; AVX512VL-X86-NEXT:    kmovw %eax, %k1
526; AVX512VL-X86-NEXT:    vptestnmd %xmm0, %xmm1, %k0 {%k1}
527; AVX512VL-X86-NEXT:    kmovw %k0, %eax
528; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
529; AVX512VL-X86-NEXT:    retl
530;
531; AVX512F-X64-LABEL: TEST_mm_mask_testn_epi32_mask:
532; AVX512F-X64:       # %bb.0: # %entry
533; AVX512F-X64-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
534; AVX512F-X64-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
535; AVX512F-X64-NEXT:    kmovw %edi, %k1
536; AVX512F-X64-NEXT:    vptestnmd %zmm0, %zmm1, %k0 {%k1}
537; AVX512F-X64-NEXT:    kshiftlw $12, %k0, %k0
538; AVX512F-X64-NEXT:    kshiftrw $12, %k0, %k0
539; AVX512F-X64-NEXT:    kmovw %k0, %eax
540; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
541; AVX512F-X64-NEXT:    vzeroupper
542; AVX512F-X64-NEXT:    retq
543;
544; AVX512F-X86-LABEL: TEST_mm_mask_testn_epi32_mask:
545; AVX512F-X86:       # %bb.0: # %entry
546; AVX512F-X86-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
547; AVX512F-X86-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
548; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
549; AVX512F-X86-NEXT:    kmovw %eax, %k1
550; AVX512F-X86-NEXT:    vptestnmd %zmm0, %zmm1, %k0 {%k1}
551; AVX512F-X86-NEXT:    kshiftlw $12, %k0, %k0
552; AVX512F-X86-NEXT:    kshiftrw $12, %k0, %k0
553; AVX512F-X86-NEXT:    kmovw %k0, %eax
554; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
555; AVX512F-X86-NEXT:    vzeroupper
556; AVX512F-X86-NEXT:    retl
557entry:
558  %and.i.i = and <2 x i64> %__B, %__A
559  %0 = bitcast <2 x i64> %and.i.i to <4 x i32>
560  %1 = icmp eq <4 x i32> %0, zeroinitializer
561  %2 = bitcast i8 %__U to <8 x i1>
562  %3 = shufflevector <8 x i1> %2, <8 x i1> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
563  %4 = and <4 x i1> %1, %3
564  %5 = shufflevector <4 x i1> %4, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
565  %6 = bitcast <8 x i1> %5 to i8
566  ret i8 %6
567}
568
569
570; Function Attrs: norecurse nounwind readnone
571define zeroext i8 @TEST_mm256_mask_testn_epi64_mask(i8 %__U, <4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
572; AVX512VL-X64-LABEL: TEST_mm256_mask_testn_epi64_mask:
573; AVX512VL-X64:       # %bb.0: # %entry
574; AVX512VL-X64-NEXT:    kmovw %edi, %k1
575; AVX512VL-X64-NEXT:    vptestnmq %ymm0, %ymm1, %k0 {%k1}
576; AVX512VL-X64-NEXT:    kmovw %k0, %eax
577; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
578; AVX512VL-X64-NEXT:    vzeroupper
579; AVX512VL-X64-NEXT:    retq
580;
581; AVX512VL-X86-LABEL: TEST_mm256_mask_testn_epi64_mask:
582; AVX512VL-X86:       # %bb.0: # %entry
583; AVX512VL-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
584; AVX512VL-X86-NEXT:    kmovw %eax, %k1
585; AVX512VL-X86-NEXT:    vptestnmq %ymm0, %ymm1, %k0 {%k1}
586; AVX512VL-X86-NEXT:    kmovw %k0, %eax
587; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
588; AVX512VL-X86-NEXT:    vzeroupper
589; AVX512VL-X86-NEXT:    retl
590;
591; AVX512F-X64-LABEL: TEST_mm256_mask_testn_epi64_mask:
592; AVX512F-X64:       # %bb.0: # %entry
593; AVX512F-X64-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
594; AVX512F-X64-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
595; AVX512F-X64-NEXT:    kmovw %edi, %k1
596; AVX512F-X64-NEXT:    vptestnmq %zmm0, %zmm1, %k0 {%k1}
597; AVX512F-X64-NEXT:    kshiftlw $12, %k0, %k0
598; AVX512F-X64-NEXT:    kshiftrw $12, %k0, %k0
599; AVX512F-X64-NEXT:    kmovw %k0, %eax
600; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
601; AVX512F-X64-NEXT:    vzeroupper
602; AVX512F-X64-NEXT:    retq
603;
604; AVX512F-X86-LABEL: TEST_mm256_mask_testn_epi64_mask:
605; AVX512F-X86:       # %bb.0: # %entry
606; AVX512F-X86-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
607; AVX512F-X86-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
608; AVX512F-X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
609; AVX512F-X86-NEXT:    kmovw %eax, %k1
610; AVX512F-X86-NEXT:    vptestnmq %zmm0, %zmm1, %k0 {%k1}
611; AVX512F-X86-NEXT:    kshiftlw $12, %k0, %k0
612; AVX512F-X86-NEXT:    kshiftrw $12, %k0, %k0
613; AVX512F-X86-NEXT:    kmovw %k0, %eax
614; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
615; AVX512F-X86-NEXT:    vzeroupper
616; AVX512F-X86-NEXT:    retl
617entry:
618  %and.i.i = and <4 x i64> %__B, %__A
619  %0 = icmp eq <4 x i64> %and.i.i, zeroinitializer
620  %1 = bitcast i8 %__U to <8 x i1>
621  %2 = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
622  %3 = and <4 x i1> %0, %2
623  %4 = shufflevector <4 x i1> %3, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
624  %5 = bitcast <8 x i1> %4 to i8
625  ret i8 %5
626}
627
628; Function Attrs: norecurse nounwind readnone
629define zeroext i8 @TEST_mm256_mask_testn_epi32_mask(i8 %__U, <4 x i64> %__A, <4 x i64> %__B) local_unnamed_addr #0 {
630; AVX512VL-X64-LABEL: TEST_mm256_mask_testn_epi32_mask:
631; AVX512VL-X64:       # %bb.0: # %entry
632; AVX512VL-X64-NEXT:    vptestnmd %ymm0, %ymm1, %k0
633; AVX512VL-X64-NEXT:    kmovw %k0, %eax
634; AVX512VL-X64-NEXT:    andb %dil, %al
635; AVX512VL-X64-NEXT:    # kill: def $al killed $al killed $eax
636; AVX512VL-X64-NEXT:    vzeroupper
637; AVX512VL-X64-NEXT:    retq
638;
639; AVX512VL-X86-LABEL: TEST_mm256_mask_testn_epi32_mask:
640; AVX512VL-X86:       # %bb.0: # %entry
641; AVX512VL-X86-NEXT:    vptestnmd %ymm0, %ymm1, %k0
642; AVX512VL-X86-NEXT:    kmovw %k0, %eax
643; AVX512VL-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
644; AVX512VL-X86-NEXT:    # kill: def $al killed $al killed $eax
645; AVX512VL-X86-NEXT:    vzeroupper
646; AVX512VL-X86-NEXT:    retl
647;
648; AVX512F-X64-LABEL: TEST_mm256_mask_testn_epi32_mask:
649; AVX512F-X64:       # %bb.0: # %entry
650; AVX512F-X64-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
651; AVX512F-X64-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
652; AVX512F-X64-NEXT:    vptestnmd %zmm0, %zmm1, %k0
653; AVX512F-X64-NEXT:    kmovw %k0, %eax
654; AVX512F-X64-NEXT:    andb %dil, %al
655; AVX512F-X64-NEXT:    # kill: def $al killed $al killed $eax
656; AVX512F-X64-NEXT:    vzeroupper
657; AVX512F-X64-NEXT:    retq
658;
659; AVX512F-X86-LABEL: TEST_mm256_mask_testn_epi32_mask:
660; AVX512F-X86:       # %bb.0: # %entry
661; AVX512F-X86-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
662; AVX512F-X86-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
663; AVX512F-X86-NEXT:    vptestnmd %zmm0, %zmm1, %k0
664; AVX512F-X86-NEXT:    kmovw %k0, %eax
665; AVX512F-X86-NEXT:    andb {{[0-9]+}}(%esp), %al
666; AVX512F-X86-NEXT:    # kill: def $al killed $al killed $eax
667; AVX512F-X86-NEXT:    vzeroupper
668; AVX512F-X86-NEXT:    retl
669entry:
670  %and.i.i = and <4 x i64> %__B, %__A
671  %0 = bitcast <4 x i64> %and.i.i to <8 x i32>
672  %1 = icmp eq <8 x i32> %0, zeroinitializer
673  %2 = bitcast i8 %__U to <8 x i1>
674  %3 = and <8 x i1> %1, %2
675  %4 = bitcast <8 x i1> %3 to i8
676  ret i8 %4
677}
678
679