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