1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - -Werror | FileCheck %s
2
3 // Don't include mm_malloc.h, it's system specific.
4 #define __MM_MALLOC_H
5
6 #include <x86intrin.h>
7
test_mm_maccs_epi16(__m128i a,__m128i b,__m128i c)8 __m128i test_mm_maccs_epi16(__m128i a, __m128i b, __m128i c) {
9 // CHECK-LABEL: test_mm_maccs_epi16
10 // CHECK: @llvm.x86.xop.vpmacssww
11 return _mm_maccs_epi16(a, b, c);
12 }
13
test_mm_macc_epi16(__m128i a,__m128i b,__m128i c)14 __m128i test_mm_macc_epi16(__m128i a, __m128i b, __m128i c) {
15 // CHECK-LABEL: test_mm_macc_epi16
16 // CHECK: @llvm.x86.xop.vpmacsww
17 return _mm_macc_epi16(a, b, c);
18 }
19
test_mm_maccsd_epi16(__m128i a,__m128i b,__m128i c)20 __m128i test_mm_maccsd_epi16(__m128i a, __m128i b, __m128i c) {
21 // CHECK-LABEL: test_mm_maccsd_epi16
22 // CHECK: @llvm.x86.xop.vpmacsswd
23 return _mm_maccsd_epi16(a, b, c);
24 }
25
test_mm_maccd_epi16(__m128i a,__m128i b,__m128i c)26 __m128i test_mm_maccd_epi16(__m128i a, __m128i b, __m128i c) {
27 // CHECK-LABEL: test_mm_maccd_epi16
28 // CHECK: @llvm.x86.xop.vpmacswd
29 return _mm_maccd_epi16(a, b, c);
30 }
31
test_mm_maccs_epi32(__m128i a,__m128i b,__m128i c)32 __m128i test_mm_maccs_epi32(__m128i a, __m128i b, __m128i c) {
33 // CHECK-LABEL: test_mm_maccs_epi32
34 // CHECK: @llvm.x86.xop.vpmacssdd
35 return _mm_maccs_epi32(a, b, c);
36 }
37
test_mm_macc_epi32(__m128i a,__m128i b,__m128i c)38 __m128i test_mm_macc_epi32(__m128i a, __m128i b, __m128i c) {
39 // CHECK-LABEL: test_mm_macc_epi32
40 // CHECK: @llvm.x86.xop.vpmacsdd
41 return _mm_macc_epi32(a, b, c);
42 }
43
test_mm_maccslo_epi32(__m128i a,__m128i b,__m128i c)44 __m128i test_mm_maccslo_epi32(__m128i a, __m128i b, __m128i c) {
45 // CHECK-LABEL: test_mm_maccslo_epi32
46 // CHECK: @llvm.x86.xop.vpmacssdql
47 return _mm_maccslo_epi32(a, b, c);
48 }
49
test_mm_macclo_epi32(__m128i a,__m128i b,__m128i c)50 __m128i test_mm_macclo_epi32(__m128i a, __m128i b, __m128i c) {
51 // CHECK-LABEL: test_mm_macclo_epi32
52 // CHECK: @llvm.x86.xop.vpmacsdql
53 return _mm_macclo_epi32(a, b, c);
54 }
55
test_mm_maccshi_epi32(__m128i a,__m128i b,__m128i c)56 __m128i test_mm_maccshi_epi32(__m128i a, __m128i b, __m128i c) {
57 // CHECK-LABEL: test_mm_maccshi_epi32
58 // CHECK: @llvm.x86.xop.vpmacssdqh
59 return _mm_maccshi_epi32(a, b, c);
60 }
61
test_mm_macchi_epi32(__m128i a,__m128i b,__m128i c)62 __m128i test_mm_macchi_epi32(__m128i a, __m128i b, __m128i c) {
63 // CHECK-LABEL: test_mm_macchi_epi32
64 // CHECK: @llvm.x86.xop.vpmacsdqh
65 return _mm_macchi_epi32(a, b, c);
66 }
67
test_mm_maddsd_epi16(__m128i a,__m128i b,__m128i c)68 __m128i test_mm_maddsd_epi16(__m128i a, __m128i b, __m128i c) {
69 // CHECK-LABEL: test_mm_maddsd_epi16
70 // CHECK: @llvm.x86.xop.vpmadcsswd
71 return _mm_maddsd_epi16(a, b, c);
72 }
73
test_mm_maddd_epi16(__m128i a,__m128i b,__m128i c)74 __m128i test_mm_maddd_epi16(__m128i a, __m128i b, __m128i c) {
75 // CHECK-LABEL: test_mm_maddd_epi16
76 // CHECK: @llvm.x86.xop.vpmadcswd
77 return _mm_maddd_epi16(a, b, c);
78 }
79
test_mm_haddw_epi8(__m128i a)80 __m128i test_mm_haddw_epi8(__m128i a) {
81 // CHECK-LABEL: test_mm_haddw_epi8
82 // CHECK: @llvm.x86.xop.vphaddbw
83 return _mm_haddw_epi8(a);
84 }
85
test_mm_haddd_epi8(__m128i a)86 __m128i test_mm_haddd_epi8(__m128i a) {
87 // CHECK-LABEL: test_mm_haddd_epi8
88 // CHECK: @llvm.x86.xop.vphaddbd
89 return _mm_haddd_epi8(a);
90 }
91
test_mm_haddq_epi8(__m128i a)92 __m128i test_mm_haddq_epi8(__m128i a) {
93 // CHECK-LABEL: test_mm_haddq_epi8
94 // CHECK: @llvm.x86.xop.vphaddbq
95 return _mm_haddq_epi8(a);
96 }
97
test_mm_haddd_epi16(__m128i a)98 __m128i test_mm_haddd_epi16(__m128i a) {
99 // CHECK-LABEL: test_mm_haddd_epi16
100 // CHECK: @llvm.x86.xop.vphaddwd
101 return _mm_haddd_epi16(a);
102 }
103
test_mm_haddq_epi16(__m128i a)104 __m128i test_mm_haddq_epi16(__m128i a) {
105 // CHECK-LABEL: test_mm_haddq_epi16
106 // CHECK: @llvm.x86.xop.vphaddwq
107 return _mm_haddq_epi16(a);
108 }
109
test_mm_haddq_epi32(__m128i a)110 __m128i test_mm_haddq_epi32(__m128i a) {
111 // CHECK-LABEL: test_mm_haddq_epi32
112 // CHECK: @llvm.x86.xop.vphadddq
113 return _mm_haddq_epi32(a);
114 }
115
test_mm_haddw_epu8(__m128i a)116 __m128i test_mm_haddw_epu8(__m128i a) {
117 // CHECK-LABEL: test_mm_haddw_epu8
118 // CHECK: @llvm.x86.xop.vphaddubw
119 return _mm_haddw_epu8(a);
120 }
121
test_mm_haddd_epu8(__m128i a)122 __m128i test_mm_haddd_epu8(__m128i a) {
123 // CHECK-LABEL: test_mm_haddd_epu8
124 // CHECK: @llvm.x86.xop.vphaddubd
125 return _mm_haddd_epu8(a);
126 }
127
test_mm_haddq_epu8(__m128i a)128 __m128i test_mm_haddq_epu8(__m128i a) {
129 // CHECK-LABEL: test_mm_haddq_epu8
130 // CHECK: @llvm.x86.xop.vphaddubq
131 return _mm_haddq_epu8(a);
132 }
133
test_mm_haddd_epu16(__m128i a)134 __m128i test_mm_haddd_epu16(__m128i a) {
135 // CHECK-LABEL: test_mm_haddd_epu16
136 // CHECK: @llvm.x86.xop.vphadduwd
137 return _mm_haddd_epu16(a);
138 }
139
test_mm_haddq_epu16(__m128i a)140 __m128i test_mm_haddq_epu16(__m128i a) {
141 // CHECK-LABEL: test_mm_haddq_epu16
142 // CHECK: @llvm.x86.xop.vphadduwq
143 return _mm_haddq_epu16(a);
144 }
145
test_mm_haddq_epu32(__m128i a)146 __m128i test_mm_haddq_epu32(__m128i a) {
147 // CHECK-LABEL: test_mm_haddq_epu32
148 // CHECK: @llvm.x86.xop.vphaddudq
149 return _mm_haddq_epu32(a);
150 }
151
test_mm_hsubw_epi8(__m128i a)152 __m128i test_mm_hsubw_epi8(__m128i a) {
153 // CHECK-LABEL: test_mm_hsubw_epi8
154 // CHECK: @llvm.x86.xop.vphsubbw
155 return _mm_hsubw_epi8(a);
156 }
157
test_mm_hsubd_epi16(__m128i a)158 __m128i test_mm_hsubd_epi16(__m128i a) {
159 // CHECK-LABEL: test_mm_hsubd_epi16
160 // CHECK: @llvm.x86.xop.vphsubwd
161 return _mm_hsubd_epi16(a);
162 }
163
test_mm_hsubq_epi32(__m128i a)164 __m128i test_mm_hsubq_epi32(__m128i a) {
165 // CHECK-LABEL: test_mm_hsubq_epi32
166 // CHECK: @llvm.x86.xop.vphsubdq
167 return _mm_hsubq_epi32(a);
168 }
169
test_mm_cmov_si128(__m128i a,__m128i b,__m128i c)170 __m128i test_mm_cmov_si128(__m128i a, __m128i b, __m128i c) {
171 // CHECK-LABEL: test_mm_cmov_si128
172 // CHECK: @llvm.x86.xop.vpcmov
173 return _mm_cmov_si128(a, b, c);
174 }
175
test_mm256_cmov_si256(__m256i a,__m256i b,__m256i c)176 __m256i test_mm256_cmov_si256(__m256i a, __m256i b, __m256i c) {
177 // CHECK-LABEL: test_mm256_cmov_si256
178 // CHECK: @llvm.x86.xop.vpcmov.256
179 return _mm256_cmov_si256(a, b, c);
180 }
181
test_mm_perm_epi8(__m128i a,__m128i b,__m128i c)182 __m128i test_mm_perm_epi8(__m128i a, __m128i b, __m128i c) {
183 // CHECK-LABEL: test_mm_perm_epi8
184 // CHECK: @llvm.x86.xop.vpperm
185 return _mm_perm_epi8(a, b, c);
186 }
187
test_mm_rot_epi8(__m128i a,__m128i b)188 __m128i test_mm_rot_epi8(__m128i a, __m128i b) {
189 // CHECK-LABEL: test_mm_rot_epi8
190 // CHECK: @llvm.x86.xop.vprotb
191 return _mm_rot_epi8(a, b);
192 }
193
test_mm_rot_epi16(__m128i a,__m128i b)194 __m128i test_mm_rot_epi16(__m128i a, __m128i b) {
195 // CHECK-LABEL: test_mm_rot_epi16
196 // CHECK: @llvm.x86.xop.vprotw
197 return _mm_rot_epi16(a, b);
198 }
199
test_mm_rot_epi32(__m128i a,__m128i b)200 __m128i test_mm_rot_epi32(__m128i a, __m128i b) {
201 // CHECK-LABEL: test_mm_rot_epi32
202 // CHECK: @llvm.x86.xop.vprotd
203 return _mm_rot_epi32(a, b);
204 }
205
test_mm_rot_epi64(__m128i a,__m128i b)206 __m128i test_mm_rot_epi64(__m128i a, __m128i b) {
207 // CHECK-LABEL: test_mm_rot_epi64
208 // CHECK: @llvm.x86.xop.vprotq
209 return _mm_rot_epi64(a, b);
210 }
211
test_mm_roti_epi8(__m128i a)212 __m128i test_mm_roti_epi8(__m128i a) {
213 // CHECK-LABEL: test_mm_roti_epi8
214 // CHECK: @llvm.x86.xop.vprotbi
215 return _mm_roti_epi8(a, 1);
216 }
217
test_mm_roti_epi16(__m128i a)218 __m128i test_mm_roti_epi16(__m128i a) {
219 // CHECK-LABEL: test_mm_roti_epi16
220 // CHECK: @llvm.x86.xop.vprotwi
221 return _mm_roti_epi16(a, 50);
222 }
223
test_mm_roti_epi32(__m128i a)224 __m128i test_mm_roti_epi32(__m128i a) {
225 // CHECK-LABEL: test_mm_roti_epi32
226 // CHECK: @llvm.x86.xop.vprotdi
227 return _mm_roti_epi32(a, -30);
228 }
229
test_mm_roti_epi64(__m128i a)230 __m128i test_mm_roti_epi64(__m128i a) {
231 // CHECK-LABEL: test_mm_roti_epi64
232 // CHECK: @llvm.x86.xop.vprotqi
233 return _mm_roti_epi64(a, 100);
234 }
235
test_mm_shl_epi8(__m128i a,__m128i b)236 __m128i test_mm_shl_epi8(__m128i a, __m128i b) {
237 // CHECK-LABEL: test_mm_shl_epi8
238 // CHECK: @llvm.x86.xop.vpshlb
239 return _mm_shl_epi8(a, b);
240 }
241
test_mm_shl_epi16(__m128i a,__m128i b)242 __m128i test_mm_shl_epi16(__m128i a, __m128i b) {
243 // CHECK-LABEL: test_mm_shl_epi16
244 // CHECK: @llvm.x86.xop.vpshlw
245 return _mm_shl_epi16(a, b);
246 }
247
test_mm_shl_epi32(__m128i a,__m128i b)248 __m128i test_mm_shl_epi32(__m128i a, __m128i b) {
249 // CHECK-LABEL: test_mm_shl_epi32
250 // CHECK: @llvm.x86.xop.vpshld
251 return _mm_shl_epi32(a, b);
252 }
253
test_mm_shl_epi64(__m128i a,__m128i b)254 __m128i test_mm_shl_epi64(__m128i a, __m128i b) {
255 // CHECK-LABEL: test_mm_shl_epi64
256 // CHECK: @llvm.x86.xop.vpshlq
257 return _mm_shl_epi64(a, b);
258 }
259
test_mm_sha_epi8(__m128i a,__m128i b)260 __m128i test_mm_sha_epi8(__m128i a, __m128i b) {
261 // CHECK-LABEL: test_mm_sha_epi8
262 // CHECK: @llvm.x86.xop.vpshab
263 return _mm_sha_epi8(a, b);
264 }
265
test_mm_sha_epi16(__m128i a,__m128i b)266 __m128i test_mm_sha_epi16(__m128i a, __m128i b) {
267 // CHECK-LABEL: test_mm_sha_epi16
268 // CHECK: @llvm.x86.xop.vpshaw
269 return _mm_sha_epi16(a, b);
270 }
271
test_mm_sha_epi32(__m128i a,__m128i b)272 __m128i test_mm_sha_epi32(__m128i a, __m128i b) {
273 // CHECK-LABEL: test_mm_sha_epi32
274 // CHECK: @llvm.x86.xop.vpshad
275 return _mm_sha_epi32(a, b);
276 }
277
test_mm_sha_epi64(__m128i a,__m128i b)278 __m128i test_mm_sha_epi64(__m128i a, __m128i b) {
279 // CHECK-LABEL: test_mm_sha_epi64
280 // CHECK: @llvm.x86.xop.vpshaq
281 return _mm_sha_epi64(a, b);
282 }
283
test_mm_com_epu8(__m128i a,__m128i b)284 __m128i test_mm_com_epu8(__m128i a, __m128i b) {
285 // CHECK-LABEL: test_mm_com_epu8
286 // CHECK: @llvm.x86.xop.vpcomub
287 return _mm_com_epu8(a, b, 0);
288 }
289
test_mm_com_epu16(__m128i a,__m128i b)290 __m128i test_mm_com_epu16(__m128i a, __m128i b) {
291 // CHECK-LABEL: test_mm_com_epu16
292 // CHECK: @llvm.x86.xop.vpcomuw
293 return _mm_com_epu16(a, b, 0);
294 }
295
test_mm_com_epu32(__m128i a,__m128i b)296 __m128i test_mm_com_epu32(__m128i a, __m128i b) {
297 // CHECK-LABEL: test_mm_com_epu32
298 // CHECK: @llvm.x86.xop.vpcomud
299 return _mm_com_epu32(a, b, 0);
300 }
301
test_mm_com_epu64(__m128i a,__m128i b)302 __m128i test_mm_com_epu64(__m128i a, __m128i b) {
303 // CHECK-LABEL: test_mm_com_epu64
304 // CHECK: @llvm.x86.xop.vpcomuq
305 return _mm_com_epu64(a, b, 0);
306 }
307
test_mm_com_epi8(__m128i a,__m128i b)308 __m128i test_mm_com_epi8(__m128i a, __m128i b) {
309 // CHECK-LABEL: test_mm_com_epi8
310 // CHECK: @llvm.x86.xop.vpcomb
311 return _mm_com_epi8(a, b, 0);
312 }
313
test_mm_com_epi16(__m128i a,__m128i b)314 __m128i test_mm_com_epi16(__m128i a, __m128i b) {
315 // CHECK-LABEL: test_mm_com_epi16
316 // CHECK: @llvm.x86.xop.vpcomw
317 return _mm_com_epi16(a, b, 0);
318 }
319
test_mm_com_epi32(__m128i a,__m128i b)320 __m128i test_mm_com_epi32(__m128i a, __m128i b) {
321 // CHECK-LABEL: test_mm_com_epi32
322 // CHECK: @llvm.x86.xop.vpcomd
323 return _mm_com_epi32(a, b, 0);
324 }
325
test_mm_com_epi64(__m128i a,__m128i b)326 __m128i test_mm_com_epi64(__m128i a, __m128i b) {
327 // CHECK-LABEL: test_mm_com_epi64
328 // CHECK: @llvm.x86.xop.vpcomq
329 return _mm_com_epi64(a, b, 0);
330 }
331
test_mm_permute2_pd(__m128d a,__m128d b,__m128i c)332 __m128d test_mm_permute2_pd(__m128d a, __m128d b, __m128i c) {
333 // CHECK-LABEL: test_mm_permute2_pd
334 // CHECK: @llvm.x86.xop.vpermil2pd
335 return _mm_permute2_pd(a, b, c, 0);
336 }
337
test_mm256_permute2_pd(__m256d a,__m256d b,__m256i c)338 __m256d test_mm256_permute2_pd(__m256d a, __m256d b, __m256i c) {
339 // CHECK-LABEL: test_mm256_permute2_pd
340 // CHECK: @llvm.x86.xop.vpermil2pd.256
341 return _mm256_permute2_pd(a, b, c, 0);
342 }
343
test_mm_permute2_ps(__m128 a,__m128 b,__m128i c)344 __m128 test_mm_permute2_ps(__m128 a, __m128 b, __m128i c) {
345 // CHECK-LABEL: test_mm_permute2_ps
346 // CHECK: @llvm.x86.xop.vpermil2ps
347 return _mm_permute2_ps(a, b, c, 0);
348 }
349
test_mm256_permute2_ps(__m256 a,__m256 b,__m256i c)350 __m256 test_mm256_permute2_ps(__m256 a, __m256 b, __m256i c) {
351 // CHECK-LABEL: test_mm256_permute2_ps
352 // CHECK: @llvm.x86.xop.vpermil2ps.256
353 return _mm256_permute2_ps(a, b, c, 0);
354 }
355
test_mm_frcz_ss(__m128 a)356 __m128 test_mm_frcz_ss(__m128 a) {
357 // CHECK-LABEL: test_mm_frcz_ss
358 // CHECK: @llvm.x86.xop.vfrcz.ss
359 return _mm_frcz_ss(a);
360 }
361
test_mm_frcz_sd(__m128d a)362 __m128d test_mm_frcz_sd(__m128d a) {
363 // CHECK-LABEL: test_mm_frcz_sd
364 // CHECK: @llvm.x86.xop.vfrcz.sd
365 return _mm_frcz_sd(a);
366 }
367
test_mm_frcz_ps(__m128 a)368 __m128 test_mm_frcz_ps(__m128 a) {
369 // CHECK-LABEL: test_mm_frcz_ps
370 // CHECK: @llvm.x86.xop.vfrcz.ps
371 return _mm_frcz_ps(a);
372 }
373
test_mm_frcz_pd(__m128d a)374 __m128d test_mm_frcz_pd(__m128d a) {
375 // CHECK-LABEL: test_mm_frcz_pd
376 // CHECK: @llvm.x86.xop.vfrcz.pd
377 return _mm_frcz_pd(a);
378 }
379
test_mm256_frcz_ps(__m256 a)380 __m256 test_mm256_frcz_ps(__m256 a) {
381 // CHECK-LABEL: test_mm256_frcz_ps
382 // CHECK: @llvm.x86.xop.vfrcz.ps.256
383 return _mm256_frcz_ps(a);
384 }
385
test_mm256_frcz_pd(__m256d a)386 __m256d test_mm256_frcz_pd(__m256d a) {
387 // CHECK-LABEL: test_mm256_frcz_pd
388 // CHECK: @llvm.x86.xop.vfrcz.pd.256
389 return _mm256_frcz_pd(a);
390 }
391