Debian Codegraph @

clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c

raw
1 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -fclangir -emit-cir -o %t.cir -Wall -Werror
2 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -fclangir -emit-llvm -o %t.ll -Wall -Werror
4 // RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
5
6 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror
7 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
8 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror
9 // RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
10
11 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
12 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512dq -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=OGCG
13
14 #include <immintrin.h>
15
16 __m512i test_mm512_movm_epi64(__mmask8 __A) {
17 // CIR-LABEL: _mm512_movm_epi64
18 // CIR: %{{.*}} = cir.cast bitcast %{{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
19 // CIR: %{{.*}} = cir.cast integral %{{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !cir.vector<8 x !s64i>
20
21 // LLVM-LABEL: test_mm512_movm_epi64
22 // LLVM: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1>
23 // LLVM: %{{.*}} = sext <8 x i1> %{{.*}} to <8 x i64>
24
25 // OGCG-LABEL: {{.*}}test_mm512_movm_epi64{{.*}}(
26 // OGCG: %{{.*}} = bitcast i8 %{{.*}} to <8 x i1>
27 // OGCG: %{{.*}} = sext <8 x i1> %{{.*}} to <8 x i64>
28 return _mm512_movm_epi64(__A);
29 }
30
31 __mmask8 test_kadd_mask8(__mmask8 A, __mmask8 B) {
32 // CIR-LABEL: _kadd_mask8
33 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
34 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
35 // CIR: cir.call_llvm_intrinsic "x86.avx512.kadd.b"
36 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
37
38 // LLVM-LABEL: _kadd_mask8
39 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
40 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
41 // LLVM: [[RES:%.*]] = call <8 x i1> @llvm.x86.avx512.kadd.b(<8 x i1> [[L]], <8 x i1> [[R]])
42 // LLVM: bitcast <8 x i1> [[RES]] to i8
43
44 // OGCG-LABEL: _kadd_mask8
45 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
46 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
47 // OGCG: call <8 x i1> @llvm.x86.avx512.kadd.b
48 // OGCG: bitcast <8 x i1> {{.*}} to i8
49 return _kadd_mask8(A, B);
50 }
51
52 __mmask16 test_kadd_mask16(__mmask16 A, __mmask16 B) {
53 // CIR-LABEL: _kadd_mask16
54 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
55 // CIR: cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
56 // CIR: cir.call_llvm_intrinsic "x86.avx512.kadd.w"
57 // CIR: cir.cast bitcast {{.*}} : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
58
59 // LLVM-LABEL: _kadd_mask16
60 // LLVM: [[L:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
61 // LLVM: [[R:%.*]] = bitcast i16 %{{.*}} to <16 x i1>
62 // LLVM: [[RES:%.*]] = call <16 x i1> @llvm.x86.avx512.kadd.w(<16 x i1> [[L]], <16 x i1> [[R]])
63 // LLVM: bitcast <16 x i1> [[RES]] to i16
64
65 // OGCG-LABEL: _kadd_mask16
66 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
67 // OGCG: bitcast i16 %{{.*}} to <16 x i1>
68 // OGCG: call <16 x i1> @llvm.x86.avx512.kadd.w
69 // OGCG: bitcast <16 x i1> {{.*}} to i16
70 return _kadd_mask16(A, B);
71 }
72
73 __mmask8 test_kand_mask8(__mmask8 A, __mmask8 B) {
74 // CIR-LABEL: _kand_mask8
75 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
76 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
77 // CIR: cir.binop(and, {{.*}}, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
78 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
79
80 // LLVM-LABEL: _kand_mask8
81 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
82 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
83 // LLVM: [[RES:%.*]] = and <8 x i1> [[L]], [[R]]
84 // LLVM: bitcast <8 x i1> [[RES]] to i8
85
86 // OGCG-LABEL: _kand_mask8
87 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
88 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
89 // OGCG: and <8 x i1>
90 // OGCG: bitcast <8 x i1> {{.*}} to i8
91 return _kand_mask8(A, B);
92 }
93
94
95 __mmask8 test_kandn_mask8(__mmask8 A, __mmask8 B) {
96 // CIR-LABEL: _kandn_mask8
97 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
98 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
99 // CIR: cir.unary(not, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
100 // CIR: cir.binop(and, {{.*}}, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
101 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
102
103 // LLVM-LABEL: _kandn_mask8
104 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
105 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
106 // LLVM: xor <8 x i1> [[L]], splat (i1 true)
107 // LLVM: and <8 x i1>
108 // LLVM: bitcast <8 x i1> {{.*}} to i8
109
110 // OGCG-LABEL: _kandn_mask8
111 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
112 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
113 // OGCG: xor <8 x i1>
114 // OGCG: and <8 x i1>
115 // OGCG: bitcast <8 x i1> {{.*}} to i8
116
117 return _kandn_mask8(A, B);
118 }
119
120 __mmask8 test_kor_mask8(__mmask8 A, __mmask8 B) {
121 // CIR-LABEL: _kor_mask8
122 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
123 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
124 // CIR: cir.binop(or, {{.*}}, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
125 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
126
127 // LLVM-LABEL: _kor_mask8
128 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
129 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
130 // LLVM: or <8 x i1> [[L]], [[R]]
131 // LLVM: bitcast <8 x i1> {{.*}} to i8
132
133 // OGCG-LABEL: _kor_mask8
134 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
135 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
136 // OGCG: or <8 x i1>
137 // OGCG: bitcast <8 x i1> {{.*}} to i8
138 return _kor_mask8(A, B);
139 }
140
141 __mmask8 test_kxor_mask8(__mmask8 A, __mmask8 B) {
142 // CIR-LABEL: _kxor_mask8
143 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
144 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
145 // CIR: cir.binop(xor, {{.*}}, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
146 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
147
148 // LLVM-LABEL: _kxor_mask8
149 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
150 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
151 // LLVM: xor <8 x i1> [[L]], [[R]]
152 // LLVM: bitcast <8 x i1> {{.*}} to i8
153
154 // OGCG-LABEL: _kxor_mask8
155 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
156 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
157 // OGCG: xor <8 x i1>
158 // OGCG: bitcast <8 x i1> {{.*}} to i8
159 return _kxor_mask8(A, B);
160 }
161
162 __mmask8 test_kxnor_mask8(__mmask8 A, __mmask8 B) {
163 // CIR-LABEL: _kxnor_mask8
164 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
165 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
166 // CIR: cir.unary(not, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
167 // CIR: cir.binop(xor, {{.*}}, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
168 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
169
170 // LLVM-LABEL: _kxnor_mask8
171 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
172 // LLVM: [[R:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
173 // LLVM: [[NOT:%.*]] = xor <8 x i1> [[L]], splat (i1 true)
174 // LLVM: [[RES:%.*]] = xor <8 x i1> [[NOT]], [[R]]
175 // LLVM: bitcast <8 x i1> [[RES]] to i8
176
177 // OGCG-LABEL: _kxnor_mask8
178 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
179 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
180 // OGCG: xor <8 x i1>
181 // OGCG: xor <8 x i1>
182 // OGCG: bitcast <8 x i1> {{.*}} to i8
183 return _kxnor_mask8(A, B);
184 }
185
186
187 __mmask8 test_knot_mask8(__mmask8 A) {
188 // CIR-LABEL: _knot_mask8
189 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
190 // CIR: cir.unary(not, {{.*}}) : !cir.vector<8 x !cir.int<s, 1>>
191 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
192
193 // LLVM-LABEL: _knot_mask8
194 // LLVM: [[L:%.*]] = bitcast i8 %{{.*}} to <8 x i1>
195 // LLVM: xor <8 x i1> [[L]], {{.*}}
196 // LLVM: bitcast <8 x i1> {{.*}} to i8
197
198 // OGCG-LABEL: _knot_mask8
199 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
200 // OGCG: xor <8 x i1>
201 // OGCG: bitcast <8 x i1> {{.*}} to i8
202 return _knot_mask8(A);
203 }
204
205 // Multiple user-level mask helpers inline to this same kmov builtin.
206 // CIR does not implement any special lowering for those helpers.
207 //
208 // Therefore, testing the builtin (__builtin_ia32_kmov*) directly is
209 // sufficient to cover the CIR lowering behavior. Testing each helper
210 // individually would add no new CIR paths.
211
212 __mmask8 test_kmov_b(__mmask8 A) {
213 // CIR-LABEL: test_kmov_b
214 // CIR: cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
215 // CIR: cir.cast bitcast {{.*}} : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
216
217 // LLVM-LABEL: test_kmov_b
218 // LLVM: bitcast i8 %{{.*}} to <8 x i1>
219 // LLVM: bitcast <8 x i1> {{.*}} to i8
220
221 // OGCG-LABEL: test_kmov_b
222 // OGCG: bitcast i8 %{{.*}} to <8 x i1>
223 // OGCG: bitcast <8 x i1> {{.*}} to i8
224 return __builtin_ia32_kmovb(A);
225 }
226
227 unsigned char test_kortestc_mask8_u8(__mmask8 __A, __mmask8 __B) {
228 // CIR-LABEL: _kortestc_mask8_u8
229 // CIR: %[[ALL_ONES:.*]] = cir.const #cir.int<255> : !u8i
230 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
231 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
232 // CIR: %[[OR:.*]] = cir.binop(or, %[[LHS]], %[[RHS]]) : !cir.vector<8 x !cir.int<s, 1>>
233 // CIR: %[[OR_INT:.*]] = cir.cast bitcast %[[OR]] : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
234 // CIR: %[[CMP:.*]] = cir.cmp(eq, %[[OR_INT]], %[[ALL_ONES]]) : !u8i, !cir.bool
235 // CIR: cir.cast bool_to_int %[[CMP]] : !cir.bool -> !s32i
236 // CIR: cir.cast integral {{.*}} : !s32i -> !u8i
237
238 // LLVM-LABEL: _kortestc_mask8_u8
239 // LLVM: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
240 // LLVM: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
241 // LLVM: %[[OR:.*]] = or <8 x i1> %[[LHS]], %[[RHS]]
242 // LLVM: %[[CAST:.*]] = bitcast <8 x i1> %[[OR]] to i8
243 // LLVM: %[[CMP:.*]] = icmp eq i8 %[[CAST]], -1
244 // LLVM: %[[ZEXT:.*]] = zext i1 %[[CMP]] to i32
245 // LLVM: trunc i32 %[[ZEXT]] to i8
246
247 // OGCG-LABEL: _kortestc_mask8_u8
248 // OGCG: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
249 // OGCG: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
250 // OGCG: %[[OR:.*]] = or <8 x i1> %[[LHS]], %[[RHS]]
251 // OGCG: %[[CAST:.*]] = bitcast <8 x i1> %[[OR]] to i8
252 // OGCG: %[[CMP:.*]] = icmp eq i8 %[[CAST]], -1
253 // OGCG: %[[ZEXT:.*]] = zext i1 %[[CMP]] to i32
254 // OGCG: trunc i32 %[[ZEXT]] to i8
255 return _kortestc_mask8_u8(__A,__B);
256 }
257
258 unsigned char test_ktestc_mask8_u8(__mmask8 A, __mmask8 B) {
259 // CIR-LABEL: _ktestc_mask8_u8
260 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
261 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
262 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.ktestc.b"
263 // CIR: cir.cast integral %[[RES]] : {{.*}} -> !u8i
264
265 // LLVM-LABEL: _ktestc_mask8_u8
266 // LLVM: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
267 // LLVM: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
268 // LLVM: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestc.b(<8 x i1> %[[LHS]], <8 x i1> %[[RHS]])
269 // LLVM: trunc i32 %[[RES]] to i8
270
271 // OGCG-LABEL: _ktestc_mask8_u8
272 // OGCG: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
273 // OGCG: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
274 // OGCG: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestc.b
275 // OGCG: trunc i32 %[[RES]] to i8
276 return _ktestc_mask8_u8(A, B);
277 }
278
279 unsigned char test_ktestz_mask8_u8(__mmask8 A, __mmask8 B) {
280 // CIR-LABEL: _ktestz_mask8_u8
281 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
282 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u8i -> !cir.vector<8 x !cir.int<s, 1>>
283 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.ktestz.b"
284 // CIR: cir.cast integral %[[RES]] : {{.*}} -> !u8i
285
286 // LLVM-LABEL: _ktestz_mask8_u8
287 // LLVM: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
288 // LLVM: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
289 // LLVM: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestz.b(<8 x i1> %[[LHS]], <8 x i1> %[[RHS]])
290 // LLVM: trunc i32 %[[RES]] to i8
291
292 // OGCG-LABEL: _ktestz_mask8_u8
293 // OGCG: %[[LHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
294 // OGCG: %[[RHS:.*]] = bitcast i8 %{{.*}} to <8 x i1>
295 // OGCG: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestz.b
296 // OGCG: trunc i32 %[[RES]] to i8
297 return _ktestz_mask8_u8(A, B);
298 }
299
300 unsigned char test_ktestc_mask16_u8(__mmask16 A, __mmask16 B) {
301 // CIR-LABEL: _ktestc_mask16_u8
302 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
303 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
304 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.ktestc.w"
305 // CIR: cir.cast integral %[[RES]] : {{.*}} -> !u8i
306
307 // LLVM-LABEL: _ktestc_mask16_u8
308 // LLVM: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
309 // LLVM: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
310 // LLVM: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestc.w(<16 x i1> %[[LHS]], <16 x i1> %[[RHS]])
311 // LLVM: trunc i32 %[[RES]] to i8
312
313 // OGCG-LABEL: _ktestc_mask16_u8
314 // OGCG: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
315 // OGCG: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
316 // OGCG: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestc.w
317 // OGCG: trunc i32 %[[RES]] to i8
318 return _ktestc_mask16_u8(A, B);
319 }
320
321 unsigned char test_ktestz_mask16_u8(__mmask16 A, __mmask16 B) {
322 // CIR-LABEL: _ktestz_mask16_u8
323 // CIR: %[[LHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
324 // CIR: %[[RHS:.*]] = cir.cast bitcast {{.*}} : !u16i -> !cir.vector<16 x !cir.int<s, 1>>
325 // CIR: %[[RES:.*]] = cir.call_llvm_intrinsic "x86.avx512.ktestz.w"
326 // CIR: cir.cast integral %[[RES]] : {{.*}} -> !u8i
327
328 // LLVM-LABEL: _ktestz_mask16_u8
329 // LLVM: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
330 // LLVM: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
331 // LLVM: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestz.w(<16 x i1> %[[LHS]], <16 x i1> %[[RHS]])
332 // LLVM: trunc i32 %[[RES]] to i8
333
334 // OGCG-LABEL: _ktestz_mask16_u8
335 // OGCG: %[[LHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
336 // OGCG: %[[RHS:.*]] = bitcast i16 %{{.*}} to <16 x i1>
337 // OGCG: %[[RES:.*]] = call i32 @llvm.x86.avx512.ktestz.w
338 // OGCG: trunc i32 %[[RES]] to i8
339 return _ktestz_mask16_u8(A, B);
340 }
341
342 __mmask16 test_mm512_movepi32_mask(__m512i __A) {
343 // CIR-LABEL: _mm512_movepi32_mask
344 // CIR: cir.cast bitcast %{{.*}} : !cir.vector<8 x !s64i> -> !cir.vector<16 x !s32i>
345 // CIR: [[CMP:%.*]] = cir.vec.cmp(lt, %{{.*}}, %{{.*}}) : !cir.vector<16 x !s32i>, !cir.vector<16 x !cir.int<s, 1>>
346 // CIR: %{{.*}} = cir.cast bitcast [[CMP]] : !cir.vector<16 x !cir.int<s, 1>> -> !u16i
347
348 // LLVM-LABEL: test_mm512_movepi32_mask
349 // LLVM: [[CMP:%.*]] = icmp slt <16 x i32> %{{.*}}, zeroinitializer
350 // LLVM: bitcast <16 x i1> [[CMP]] to i16
351
352 // OGCG-LABEL: {{.*}}test_mm512_movepi32_mask{{.*}}(
353 // OGCG: [[CMP:%.*]] = icmp slt <16 x i32> %{{.*}}, zeroinitializer
354 // OGCG: bitcast <16 x i1> [[CMP]] to i16
355 return _mm512_movepi32_mask(__A);
356 }
357
358 __mmask8 test_mm512_movepi64_mask(__m512i __A) {
359 // CIR-LABEL: _mm512_movepi64_mask
360 // CIR: [[CMP:%.*]] = cir.vec.cmp(lt, %{{.*}}, %{{.*}}) : !cir.vector<8 x !s64i>, !cir.vector<8 x !cir.int<s, 1>>
361 // CIR: %{{.*}} = cir.cast bitcast [[CMP]] : !cir.vector<8 x !cir.int<s, 1>> -> !u8i
362
363 // LLVM-LABEL: test_mm512_movepi64_mask
364 // LLVM: [[CMP:%.*]] = icmp slt <8 x i64> %{{.*}}, zeroinitializer
365 // LLVM: bitcast <8 x i1> [[CMP]] to i8
366
367 // OGCG-LABEL: {{.*}}test_mm512_movepi64_mask{{.*}}(
368 // OGCG: [[CMP:%.*]] = icmp slt <8 x i64> %{{.*}}, zeroinitializer
369 // OGCG: bitcast <8 x i1> [[CMP]] to i8
370 return _mm512_movepi64_mask(__A);
371 }
372
373 __m512 test_mm512_insertf32x8(__m512 __A, __m256 __B) {
374 // CIR-LABEL: test_mm512_insertf32x8
375 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !cir.float>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<20> : !s32i, #cir.int<21> : !s32i, #cir.int<22> : !s32i, #cir.int<23> : !s32i] : !cir.vector<16 x !cir.float>
376
377 // LLVM-LABEL: test_mm512_insertf32x8
378 // LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
379
380 // OGCG-LABEL: test_mm512_insertf32x8
381 // OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
382 return _mm512_insertf32x8(__A, __B, 1);
383 }
384
385 __m512i test_mm512_inserti32x8(__m512i __A, __m256i __B) {
386 // CIR-LABEL: test_mm512_inserti32x8
387 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<16 x !s32i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i, #cir.int<16> : !s32i, #cir.int<17> : !s32i, #cir.int<18> : !s32i, #cir.int<19> : !s32i, #cir.int<20> : !s32i, #cir.int<21> : !s32i, #cir.int<22> : !s32i, #cir.int<23> : !s32i] : !cir.vector<16 x !s32i>
388
389 // LLVM-LABEL: test_mm512_inserti32x8
390 // LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
391
392 // OGCG-LABEL: test_mm512_inserti32x8
393 // OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
394 return _mm512_inserti32x8(__A, __B, 1);
395 }
396
397 __m512d test_mm512_insertf64x2(__m512d __A, __m128d __B) {
398 // CIR-LABEL: test_mm512_insertf64x2
399 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !cir.double>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i] : !cir.vector<8 x !cir.double>
400
401 // LLVM-LABEL: test_mm512_insertf64x2
402 // LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
403
404 // OGCG-LABEL: test_mm512_insertf64x2
405 // OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 8, i32 9>
406 return _mm512_insertf64x2(__A, __B, 3);
407 }
408
409 __m512i test_mm512_inserti64x2(__m512i __A, __m128i __B) {
410 // CIR-LABEL: test_mm512_inserti64x2
411 // CIR: %{{.*}} = cir.vec.shuffle(%{{.*}}, %{{.*}} : !cir.vector<8 x !s64i>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i, #cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<8 x !s64i>
412
413 // LLVM-LABEL: test_mm512_inserti64x2
414 // LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 4, i32 5, i32 6, i32 7>
415
416 // OGCG-LABEL: test_mm512_inserti64x2
417 // OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 4, i32 5, i32 6, i32 7>
418 return _mm512_inserti64x2(__A, __B, 1);
419 }