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