1 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
3 
4 
5 #include <immintrin.h>
6 
7 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse41-intrinsics-fast-isel.ll
8 
test_mm_blend_epi16(__m128i V1,__m128i V2)9 __m128i test_mm_blend_epi16(__m128i V1, __m128i V2) {
10   // CHECK-LABEL: test_mm_blend_epi16
11   // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 7>
12   return _mm_blend_epi16(V1, V2, 42);
13 }
14 
test_mm_blend_pd(__m128d V1,__m128d V2)15 __m128d test_mm_blend_pd(__m128d V1, __m128d V2) {
16   // CHECK-LABEL: test_mm_blend_pd
17   // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> <i32 0, i32 3>
18   return _mm_blend_pd(V1, V2, 2);
19 }
20 
test_mm_blend_ps(__m128 V1,__m128 V2)21 __m128 test_mm_blend_ps(__m128 V1, __m128 V2) {
22   // CHECK-LABEL: test_mm_blend_ps
23   // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
24   return _mm_blend_ps(V1, V2, 6);
25 }
26 
test_mm_blendv_epi8(__m128i V1,__m128i V2,__m128i V3)27 __m128i test_mm_blendv_epi8(__m128i V1, __m128i V2, __m128i V3) {
28   // CHECK-LABEL: test_mm_blendv_epi8
29   // CHECK: call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}})
30   return _mm_blendv_epi8(V1, V2, V3);
31 }
32 
test_mm_blendv_pd(__m128d V1,__m128d V2,__m128d V3)33 __m128d test_mm_blendv_pd(__m128d V1, __m128d V2, __m128d V3) {
34   // CHECK-LABEL: test_mm_blendv_pd
35   // CHECK: call <2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
36   return _mm_blendv_pd(V1, V2, V3);
37 }
38 
test_mm_blendv_ps(__m128 V1,__m128 V2,__m128 V3)39 __m128 test_mm_blendv_ps(__m128 V1, __m128 V2, __m128 V3) {
40   // CHECK-LABEL: test_mm_blendv_ps
41   // CHECK: call <4 x float> @llvm.x86.sse41.blendvps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
42   return _mm_blendv_ps(V1, V2, V3);
43 }
44 
test_mm_ceil_pd(__m128d x)45 __m128d test_mm_ceil_pd(__m128d x) {
46   // CHECK-LABEL: test_mm_ceil_pd
47   // CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 2)
48   return _mm_ceil_pd(x);
49 }
50 
test_mm_ceil_ps(__m128 x)51 __m128 test_mm_ceil_ps(__m128 x) {
52   // CHECK-LABEL: test_mm_ceil_ps
53   // CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 2)
54   return _mm_ceil_ps(x);
55 }
56 
test_mm_ceil_sd(__m128d x,__m128d y)57 __m128d test_mm_ceil_sd(__m128d x, __m128d y) {
58   // CHECK-LABEL: test_mm_ceil_sd
59   // CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 2)
60   return _mm_ceil_sd(x, y);
61 }
62 
test_mm_ceil_ss(__m128 x,__m128 y)63 __m128 test_mm_ceil_ss(__m128 x, __m128 y) {
64   // CHECK-LABEL: test_mm_ceil_ss
65   // CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 2)
66   return _mm_ceil_ss(x, y);
67 }
68 
test_mm_cmpeq_epi64(__m128i A,__m128i B)69 __m128i test_mm_cmpeq_epi64(__m128i A, __m128i B) {
70   // CHECK-LABEL: test_mm_cmpeq_epi64
71   // CHECK: icmp eq <2 x i64>
72   // CHECK: sext <2 x i1> %{{.*}} to <2 x i64>
73   return _mm_cmpeq_epi64(A, B);
74 }
75 
test_mm_cvtepi8_epi16(__m128i a)76 __m128i test_mm_cvtepi8_epi16(__m128i a) {
77   // CHECK-LABEL: test_mm_cvtepi8_epi16
78   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
79   // CHECK: sext <8 x i8> {{.*}} to <8 x i16>
80   return _mm_cvtepi8_epi16(a);
81 }
82 
test_mm_cvtepi8_epi32(__m128i a)83 __m128i test_mm_cvtepi8_epi32(__m128i a) {
84   // CHECK-LABEL: test_mm_cvtepi8_epi32
85   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
86   // CHECK: sext <4 x i8> {{.*}} to <4 x i32>
87   return _mm_cvtepi8_epi32(a);
88 }
89 
test_mm_cvtepi8_epi64(__m128i a)90 __m128i test_mm_cvtepi8_epi64(__m128i a) {
91   // CHECK-LABEL: test_mm_cvtepi8_epi64
92   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> <i32 0, i32 1>
93   // CHECK: sext <2 x i8> {{.*}} to <2 x i64>
94   return _mm_cvtepi8_epi64(a);
95 }
96 
test_mm_cvtepi16_epi32(__m128i a)97 __m128i test_mm_cvtepi16_epi32(__m128i a) {
98   // CHECK-LABEL: test_mm_cvtepi16_epi32
99   // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
100   // CHECK: sext <4 x i16> {{.*}} to <4 x i32>
101   return _mm_cvtepi16_epi32(a);
102 }
103 
test_mm_cvtepi16_epi64(__m128i a)104 __m128i test_mm_cvtepi16_epi64(__m128i a) {
105   // CHECK-LABEL: test_mm_cvtepi16_epi64
106   // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> <i32 0, i32 1>
107   // CHECK: sext <2 x i16> {{.*}} to <2 x i64>
108   return _mm_cvtepi16_epi64(a);
109 }
110 
test_mm_cvtepi32_epi64(__m128i a)111 __m128i test_mm_cvtepi32_epi64(__m128i a) {
112   // CHECK-LABEL: test_mm_cvtepi32_epi64
113   // CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> <i32 0, i32 1>
114   // CHECK: sext <2 x i32> {{.*}} to <2 x i64>
115   return _mm_cvtepi32_epi64(a);
116 }
117 
test_mm_cvtepu8_epi16(__m128i a)118 __m128i test_mm_cvtepu8_epi16(__m128i a) {
119   // CHECK-LABEL: test_mm_cvtepu8_epi16
120   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
121   // CHECK: zext <8 x i8> {{.*}} to <8 x i16>
122   return _mm_cvtepu8_epi16(a);
123 }
124 
test_mm_cvtepu8_epi32(__m128i a)125 __m128i test_mm_cvtepu8_epi32(__m128i a) {
126   // CHECK-LABEL: test_mm_cvtepu8_epi32
127   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
128   // CHECK: zext <4 x i8> {{.*}} to <4 x i32>
129   return _mm_cvtepu8_epi32(a);
130 }
131 
test_mm_cvtepu8_epi64(__m128i a)132 __m128i test_mm_cvtepu8_epi64(__m128i a) {
133   // CHECK-LABEL: test_mm_cvtepu8_epi64
134   // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> <i32 0, i32 1>
135   // CHECK: zext <2 x i8> {{.*}} to <2 x i64>
136   return _mm_cvtepu8_epi64(a);
137 }
138 
test_mm_cvtepu16_epi32(__m128i a)139 __m128i test_mm_cvtepu16_epi32(__m128i a) {
140   // CHECK-LABEL: test_mm_cvtepu16_epi32
141   // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
142   // CHECK: zext <4 x i16> {{.*}} to <4 x i32>
143   return _mm_cvtepu16_epi32(a);
144 }
145 
test_mm_cvtepu16_epi64(__m128i a)146 __m128i test_mm_cvtepu16_epi64(__m128i a) {
147   // CHECK-LABEL: test_mm_cvtepu16_epi64
148   // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> <i32 0, i32 1>
149   // CHECK: zext <2 x i16> {{.*}} to <2 x i64>
150   return _mm_cvtepu16_epi64(a);
151 }
152 
test_mm_cvtepu32_epi64(__m128i a)153 __m128i test_mm_cvtepu32_epi64(__m128i a) {
154   // CHECK-LABEL: test_mm_cvtepu32_epi64
155   // CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> <i32 0, i32 1>
156   // CHECK: zext <2 x i32> {{.*}} to <2 x i64>
157   return _mm_cvtepu32_epi64(a);
158 }
159 
test_mm_dp_pd(__m128d x,__m128d y)160 __m128d test_mm_dp_pd(__m128d x, __m128d y) {
161   // CHECK-LABEL: test_mm_dp_pd
162   // CHECK: call <2 x double> @llvm.x86.sse41.dppd(<2 x double> {{.*}}, <2 x double> {{.*}}, i8 7)
163   return _mm_dp_pd(x, y, 7);
164 }
165 
test_mm_dp_ps(__m128 x,__m128 y)166 __m128 test_mm_dp_ps(__m128 x, __m128 y) {
167   // CHECK-LABEL: test_mm_dp_ps
168   // CHECK: call <4 x float> @llvm.x86.sse41.dpps(<4 x float> {{.*}}, <4 x float> {{.*}}, i8 7)
169   return _mm_dp_ps(x, y, 7);
170 }
171 
test_mm_extract_epi8(__m128i x)172 int test_mm_extract_epi8(__m128i x) {
173   // CHECK-LABEL: test_mm_extract_epi8
174   // CHECK: extractelement <16 x i8> %{{.*}}, {{i32|i64}} 1
175   // CHECK: zext i8 %{{.*}} to i32
176   return _mm_extract_epi8(x, 1);
177 }
178 
test_mm_extract_epi32(__m128i x)179 int test_mm_extract_epi32(__m128i x) {
180   // CHECK-LABEL: test_mm_extract_epi32
181   // CHECK: extractelement <4 x i32> %{{.*}}, {{i32|i64}} 1
182   return _mm_extract_epi32(x, 1);
183 }
184 
185 #ifdef __x86_64__
test_mm_extract_epi64(__m128i x)186 long long test_mm_extract_epi64(__m128i x) {
187   // CHECK-LABEL: test_mm_extract_epi64
188   // CHECK: extractelement <2 x i64> %{{.*}}, {{i32|i64}} 1
189   return _mm_extract_epi64(x, 1);
190 }
191 #endif
192 
test_mm_extract_ps(__m128 x)193 int test_mm_extract_ps(__m128 x) {
194   // CHECK-LABEL: test_mm_extract_ps
195   // CHECK: extractelement <4 x float> %{{.*}}, {{i32|i64}} 1
196   return _mm_extract_ps(x, 1);
197 }
198 
test_mm_floor_pd(__m128d x)199 __m128d test_mm_floor_pd(__m128d x) {
200   // CHECK-LABEL: test_mm_floor_pd
201   // CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 1)
202   return _mm_floor_pd(x);
203 }
204 
test_mm_floor_ps(__m128 x)205 __m128 test_mm_floor_ps(__m128 x) {
206   // CHECK-LABEL: test_mm_floor_ps
207   // CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 1)
208   return _mm_floor_ps(x);
209 }
210 
test_mm_floor_sd(__m128d x,__m128d y)211 __m128d test_mm_floor_sd(__m128d x, __m128d y) {
212   // CHECK-LABEL: test_mm_floor_sd
213   // CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 1)
214   return _mm_floor_sd(x, y);
215 }
216 
test_mm_floor_ss(__m128 x,__m128 y)217 __m128 test_mm_floor_ss(__m128 x, __m128 y) {
218   // CHECK-LABEL: test_mm_floor_ss
219   // CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 1)
220   return _mm_floor_ss(x, y);
221 }
222 
test_mm_insert_epi8(__m128i x,char b)223 __m128i test_mm_insert_epi8(__m128i x, char b) {
224   // CHECK-LABEL: test_mm_insert_epi8
225   // CHECK: insertelement <16 x i8> %{{.*}}, i8 %{{.*}}, {{i32|i64}} 1
226   return _mm_insert_epi8(x, b, 1);
227 }
228 
test_mm_insert_epi32(__m128i x,int b)229 __m128i test_mm_insert_epi32(__m128i x, int b) {
230   // CHECK-LABEL: test_mm_insert_epi32
231   // CHECK: insertelement <4 x i32> %{{.*}}, i32 %{{.*}}, {{i32|i64}} 1
232   return _mm_insert_epi32(x, b, 1);
233 }
234 
235 #ifdef __x86_64__
test_mm_insert_epi64(__m128i x,long long b)236 __m128i test_mm_insert_epi64(__m128i x, long long b) {
237   // CHECK-LABEL: test_mm_insert_epi64
238   // CHECK: insertelement <2 x i64> %{{.*}}, i64 %{{.*}}, {{i32|i64}} 1
239   return _mm_insert_epi64(x, b, 1);
240 }
241 #endif
242 
test_mm_insert_ps(__m128 x,__m128 y)243 __m128 test_mm_insert_ps(__m128 x, __m128 y) {
244   // CHECK-LABEL: test_mm_insert_ps
245   // CHECK: call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 4)
246   return _mm_insert_ps(x, y, 4);
247 }
248 
test_mm_max_epi8(__m128i x,__m128i y)249 __m128i test_mm_max_epi8(__m128i x, __m128i y) {
250   // CHECK-LABEL: test_mm_max_epi8
251   // CHECK:       [[CMP:%.*]] = icmp sgt <16 x i8> [[X:%.*]], [[Y:%.*]]
252   // CHECK-NEXT:  select <16 x i1> [[CMP]], <16 x i8> [[X]], <16 x i8> [[Y]]
253   return _mm_max_epi8(x, y);
254 }
255 
test_mm_max_epi32(__m128i x,__m128i y)256 __m128i test_mm_max_epi32(__m128i x, __m128i y) {
257   // CHECK-LABEL: test_mm_max_epi32
258   // CHECK:       [[CMP:%.*]] = icmp sgt <4 x i32> [[X:%.*]], [[Y:%.*]]
259   // CHECK-NEXT:  select <4 x i1> [[CMP]], <4 x i32> [[X]], <4 x i32> [[Y]]
260   return _mm_max_epi32(x, y);
261 }
262 
test_mm_max_epu16(__m128i x,__m128i y)263 __m128i test_mm_max_epu16(__m128i x, __m128i y) {
264   // CHECK-LABEL: test_mm_max_epu16
265   // CHECK:       [[CMP:%.*]] = icmp ugt <8 x i16> [[X:%.*]], [[Y:%.*]]
266   // CHECK-NEXT:  select <8 x i1> [[CMP]], <8 x i16> [[X]], <8 x i16> [[Y]]
267   return _mm_max_epu16(x, y);
268 }
269 
test_mm_max_epu32(__m128i x,__m128i y)270 __m128i test_mm_max_epu32(__m128i x, __m128i y) {
271   // CHECK-LABEL: test_mm_max_epu32
272   // CHECK:       [[CMP:%.*]] = icmp ugt <4 x i32> [[X:%.*]], [[Y:%.*]]
273   // CHECK-NEXT:  select <4 x i1> [[CMP]], <4 x i32> [[X]], <4 x i32> [[Y]]
274   return _mm_max_epu32(x, y);
275 }
276 
test_mm_min_epi8(__m128i x,__m128i y)277 __m128i test_mm_min_epi8(__m128i x, __m128i y) {
278   // CHECK-LABEL: test_mm_min_epi8
279   // CHECK:       [[CMP:%.*]] = icmp slt <16 x i8> [[X:%.*]], [[Y:%.*]]
280   // CHECK-NEXT:  select <16 x i1> [[CMP]], <16 x i8> [[X]], <16 x i8> [[Y]]
281   return _mm_min_epi8(x, y);
282 }
283 
test_mm_min_epi32(__m128i x,__m128i y)284 __m128i test_mm_min_epi32(__m128i x, __m128i y) {
285   // CHECK-LABEL: test_mm_min_epi32
286   // CHECK:       [[CMP:%.*]] = icmp slt <4 x i32> [[X:%.*]], [[Y:%.*]]
287   // CHECK-NEXT:  select <4 x i1> [[CMP]], <4 x i32> [[X]], <4 x i32> [[Y]]
288   return _mm_min_epi32(x, y);
289 }
290 
test_mm_min_epu16(__m128i x,__m128i y)291 __m128i test_mm_min_epu16(__m128i x, __m128i y) {
292   // CHECK-LABEL: test_mm_min_epu16
293   // CHECK:       [[CMP:%.*]] = icmp ult <8 x i16> [[X:%.*]], [[Y:%.*]]
294   // CHECK-NEXT:  select <8 x i1> [[CMP]], <8 x i16> [[X]], <8 x i16> [[Y]]
295   return _mm_min_epu16(x, y);
296 }
297 
test_mm_min_epu32(__m128i x,__m128i y)298 __m128i test_mm_min_epu32(__m128i x, __m128i y) {
299   // CHECK-LABEL: test_mm_min_epu32
300   // CHECK:       [[CMP:%.*]] = icmp ult <4 x i32> [[X:%.*]], [[Y:%.*]]
301   // CHECK-NEXT:  select <4 x i1> [[CMP]], <4 x i32> [[X]], <4 x i32> [[Y]]
302   return _mm_min_epu32(x, y);
303 }
304 
test_mm_minpos_epu16(__m128i x)305 __m128i test_mm_minpos_epu16(__m128i x) {
306   // CHECK-LABEL: test_mm_minpos_epu16
307   // CHECK: call <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16> %{{.*}})
308   return _mm_minpos_epu16(x);
309 }
310 
test_mm_mpsadbw_epu8(__m128i x,__m128i y)311 __m128i test_mm_mpsadbw_epu8(__m128i x, __m128i y) {
312   // CHECK-LABEL: test_mm_mpsadbw_epu8
313   // CHECK: call <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 1)
314   return _mm_mpsadbw_epu8(x, y, 1);
315 }
316 
test_mm_mul_epi32(__m128i x,__m128i y)317 __m128i test_mm_mul_epi32(__m128i x, __m128i y) {
318   // CHECK-LABEL: test_mm_mul_epi32
319   // CHECK: shl <2 x i64> %{{.*}}, <i64 32, i64 32>
320   // CHECK: ashr <2 x i64> %{{.*}}, <i64 32, i64 32>
321   // CHECK: shl <2 x i64> %{{.*}}, <i64 32, i64 32>
322   // CHECK: ashr <2 x i64> %{{.*}}, <i64 32, i64 32>
323   // CHECK: mul <2 x i64> %{{.*}}, %{{.*}}
324   return _mm_mul_epi32(x, y);
325 }
326 
test_mm_mullo_epi32(__m128i x,__m128i y)327 __m128i test_mm_mullo_epi32(__m128i x, __m128i y) {
328   // CHECK-LABEL: test_mm_mullo_epi32
329   // CHECK: mul <4 x i32>
330   return _mm_mullo_epi32(x, y);
331 }
332 
test_mm_packus_epi32(__m128i x,__m128i y)333 __m128i test_mm_packus_epi32(__m128i x, __m128i y) {
334   // CHECK-LABEL: test_mm_packus_epi32
335   // CHECK: call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
336   return _mm_packus_epi32(x, y);
337 }
338 
test_mm_round_pd(__m128d x)339 __m128d test_mm_round_pd(__m128d x) {
340   // CHECK-LABEL: test_mm_round_pd
341   // CHECK: call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 4)
342   return _mm_round_pd(x, 4);
343 }
344 
test_mm_round_ps(__m128 x)345 __m128 test_mm_round_ps(__m128 x) {
346   // CHECK-LABEL: test_mm_round_ps
347   // CHECK: call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %{{.*}}, i32 4)
348   return _mm_round_ps(x, 4);
349 }
350 
test_mm_round_sd(__m128d x,__m128d y)351 __m128d test_mm_round_sd(__m128d x, __m128d y) {
352   // CHECK-LABEL: test_mm_round_sd
353   // CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 4)
354   return _mm_round_sd(x, y, 4);
355 }
356 
test_mm_round_ss(__m128 x,__m128 y)357 __m128 test_mm_round_ss(__m128 x, __m128 y) {
358   // CHECK-LABEL: test_mm_round_ss
359   // CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 4)
360   return _mm_round_ss(x, y, 4);
361 }
362 
test_mm_stream_load_si128(__m128i const * a)363 __m128i test_mm_stream_load_si128(__m128i const *a) {
364   // CHECK-LABEL: test_mm_stream_load_si128
365   // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 16, !nontemporal
366   return _mm_stream_load_si128(a);
367 }
368 
test_mm_test_all_ones(__m128i x)369 int test_mm_test_all_ones(__m128i x) {
370   // CHECK-LABEL: test_mm_test_all_ones
371   // CHECK: call i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
372   return _mm_test_all_ones(x);
373 }
374 
test_mm_test_all_zeros(__m128i x,__m128i y)375 int test_mm_test_all_zeros(__m128i x, __m128i y) {
376   // CHECK-LABEL: test_mm_test_all_zeros
377   // CHECK: call i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
378   return _mm_test_all_zeros(x, y);
379 }
380 
test_mm_test_mix_ones_zeros(__m128i x,__m128i y)381 int test_mm_test_mix_ones_zeros(__m128i x, __m128i y) {
382   // CHECK-LABEL: test_mm_test_mix_ones_zeros
383   // CHECK: call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
384   return _mm_test_mix_ones_zeros(x, y);
385 }
386 
test_mm_testc_si128(__m128i x,__m128i y)387 int test_mm_testc_si128(__m128i x, __m128i y) {
388   // CHECK-LABEL: test_mm_testc_si128
389   // CHECK: call i32 @llvm.x86.sse41.ptestc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
390   return _mm_testc_si128(x, y);
391 }
392 
test_mm_testnzc_si128(__m128i x,__m128i y)393 int test_mm_testnzc_si128(__m128i x, __m128i y) {
394   // CHECK-LABEL: test_mm_testnzc_si128
395   // CHECK: call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
396   return _mm_testnzc_si128(x, y);
397 }
398 
test_mm_testz_si128(__m128i x,__m128i y)399 int test_mm_testz_si128(__m128i x, __m128i y) {
400   // CHECK-LABEL: test_mm_testz_si128
401   // CHECK: call i32 @llvm.x86.sse41.ptestz(<2 x i64> %{{.*}}, <2 x i64> %{{.*}})
402   return _mm_testz_si128(x, y);
403 }
404