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
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
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
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
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
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
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
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
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
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
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
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
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
68__m128i test_mm_haddw_epi8(__m128i a) {
69  // CHECK: @llvm.x86.xop.vphaddbw
70  return _mm_haddw_epi8(a);
71}
72
73__m128i test_mm_haddd_epi8(__m128i a) {
74  // CHECK: @llvm.x86.xop.vphaddbd
75  return _mm_haddd_epi8(a);
76}
77
78__m128i test_mm_haddq_epi8(__m128i a) {
79  // CHECK: @llvm.x86.xop.vphaddbq
80  return _mm_haddq_epi8(a);
81}
82
83__m128i test_mm_haddd_epi16(__m128i a) {
84  // CHECK: @llvm.x86.xop.vphaddwd
85  return _mm_haddd_epi16(a);
86}
87
88__m128i test_mm_haddq_epi16(__m128i a) {
89  // CHECK: @llvm.x86.xop.vphaddwq
90  return _mm_haddq_epi16(a);
91}
92
93__m128i test_mm_haddq_epi32(__m128i a) {
94  // CHECK: @llvm.x86.xop.vphadddq
95  return _mm_haddq_epi32(a);
96}
97
98__m128i test_mm_haddw_epu8(__m128i a) {
99  // CHECK: @llvm.x86.xop.vphaddubw
100  return _mm_haddw_epu8(a);
101}
102
103__m128i test_mm_haddd_epu8(__m128i a) {
104  // CHECK: @llvm.x86.xop.vphaddubd
105  return _mm_haddd_epu8(a);
106}
107
108__m128i test_mm_haddq_epu8(__m128i a) {
109  // CHECK: @llvm.x86.xop.vphaddubq
110  return _mm_haddq_epu8(a);
111}
112
113__m128i test_mm_haddd_epu16(__m128i a) {
114  // CHECK: @llvm.x86.xop.vphadduwd
115  return _mm_haddd_epu16(a);
116}
117
118__m128i test_mm_haddq_epu16(__m128i a) {
119  // CHECK: @llvm.x86.xop.vphadduwq
120  return _mm_haddq_epu16(a);
121}
122
123__m128i test_mm_haddq_epu32(__m128i a) {
124  // CHECK: @llvm.x86.xop.vphaddudq
125  return _mm_haddq_epu32(a);
126}
127
128__m128i test_mm_hsubw_epi8(__m128i a) {
129  // CHECK: @llvm.x86.xop.vphsubbw
130  return _mm_hsubw_epi8(a);
131}
132
133__m128i test_mm_hsubd_epi16(__m128i a) {
134  // CHECK: @llvm.x86.xop.vphsubwd
135  return _mm_hsubd_epi16(a);
136}
137
138__m128i test_mm_hsubq_epi32(__m128i a) {
139  // CHECK: @llvm.x86.xop.vphsubdq
140  return _mm_hsubq_epi32(a);
141}
142
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
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
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
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
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
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
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
178__m128i test_mm_roti_epi8(__m128i a) {
179  // CHECK: @llvm.x86.xop.vprotbi
180  return _mm_roti_epi8(a, 1);
181}
182
183__m128i test_mm_roti_epi16(__m128i a) {
184  // CHECK: @llvm.x86.xop.vprotwi
185  return _mm_roti_epi16(a, 50);
186}
187
188__m128i test_mm_roti_epi32(__m128i a) {
189  // CHECK: @llvm.x86.xop.vprotdi
190  return _mm_roti_epi32(a, -30);
191}
192
193__m128i test_mm_roti_epi64(__m128i a) {
194  // CHECK: @llvm.x86.xop.vprotqi
195  return _mm_roti_epi64(a, 100);
196}
197
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
298__m128 test_mm_frcz_ss(__m128 a) {
299  // CHECK: @llvm.x86.xop.vfrcz.ss
300  return _mm_frcz_ss(a);
301}
302
303__m128d test_mm_frcz_sd(__m128d a) {
304  // CHECK: @llvm.x86.xop.vfrcz.sd
305  return _mm_frcz_sd(a);
306}
307
308__m128 test_mm_frcz_ps(__m128 a) {
309  // CHECK: @llvm.x86.xop.vfrcz.ps
310  return _mm_frcz_ps(a);
311}
312
313__m128d test_mm_frcz_pd(__m128d a) {
314  // CHECK: @llvm.x86.xop.vfrcz.pd
315  return _mm_frcz_pd(a);
316}
317
318__m256 test_mm256_frcz_ps(__m256 a) {
319  // CHECK: @llvm.x86.xop.vfrcz.ps.256
320  return _mm256_frcz_ps(a);
321}
322
323__m256d test_mm256_frcz_pd(__m256d a) {
324  // CHECK: @llvm.x86.xop.vfrcz.pd.256
325  return _mm256_frcz_pd(a);
326}
327