1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -fast-isel -mtriple=i386-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,X86-SSE
3 ; RUN: llc < %s -fast-isel -mtriple=i386-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,X86-AVX,AVX1
4 ; RUN: llc < %s -fast-isel -mtriple=i386-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=AVX,X86-AVX,AVX512
5 ; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,X64-SSE
6 ; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,X64-AVX,AVX1
7 ; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=AVX,X64-AVX,AVX512
9 ; NOTE: This should use IR equivalent to what is generated by clang/test/CodeGen/sse41-builtins.c
11 define <2 x i64> @test_mm_blend_epi16(<2 x i64> %a0, <2 x i64> %a1) {
12 ; SSE-LABEL: test_mm_blend_epi16:
14 ; SSE-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6,7]
15 ; SSE-NEXT: ret{{[l|q]}}
17 ; AVX-LABEL: test_mm_blend_epi16:
19 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6,7]
20 ; AVX-NEXT: ret{{[l|q]}}
21 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
22 %arg1 = bitcast <2 x i64> %a1 to <8 x i16>
23 %shuf = shufflevector <8 x i16> %arg0, <8 x i16> %arg1, <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 7>
24 %res = bitcast <8 x i16> %shuf to <2 x i64>
28 define <2 x double> @test_mm_blend_pd(<2 x double> %a0, <2 x double> %a1) {
29 ; SSE-LABEL: test_mm_blend_pd:
31 ; SSE-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
32 ; SSE-NEXT: ret{{[l|q]}}
34 ; AVX-LABEL: test_mm_blend_pd:
36 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
37 ; AVX-NEXT: ret{{[l|q]}}
38 %res = shufflevector <2 x double> %a0, <2 x double> %a1, <2 x i32> <i32 0, i32 3>
42 define <4 x float> @test_mm_blend_ps(<4 x float> %a0, <4 x float> %a1) {
43 ; SSE-LABEL: test_mm_blend_ps:
45 ; SSE-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
46 ; SSE-NEXT: ret{{[l|q]}}
48 ; AVX-LABEL: test_mm_blend_ps:
50 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
51 ; AVX-NEXT: ret{{[l|q]}}
52 %res = shufflevector <4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
56 define <2 x i64> @test_mm_blendv_epi8(<2 x i64> %a0, <2 x i64> %a1, <2 x i64> %a2) {
57 ; SSE-LABEL: test_mm_blendv_epi8:
59 ; SSE-NEXT: movdqa %xmm0, %xmm3
60 ; SSE-NEXT: movaps %xmm2, %xmm0
61 ; SSE-NEXT: pblendvb %xmm0, %xmm1, %xmm3
62 ; SSE-NEXT: movdqa %xmm3, %xmm0
63 ; SSE-NEXT: ret{{[l|q]}}
65 ; AVX-LABEL: test_mm_blendv_epi8:
67 ; AVX-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
68 ; AVX-NEXT: ret{{[l|q]}}
69 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
70 %arg1 = bitcast <2 x i64> %a1 to <16 x i8>
71 %arg2 = bitcast <2 x i64> %a2 to <16 x i8>
72 %call = call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %arg0, <16 x i8> %arg1, <16 x i8> %arg2)
73 %res = bitcast <16 x i8> %call to <2 x i64>
76 declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) nounwind readnone
78 define <2 x double> @test_mm_blendv_pd(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2) {
79 ; SSE-LABEL: test_mm_blendv_pd:
81 ; SSE-NEXT: movapd %xmm0, %xmm3
82 ; SSE-NEXT: movaps %xmm2, %xmm0
83 ; SSE-NEXT: blendvpd %xmm0, %xmm1, %xmm3
84 ; SSE-NEXT: movapd %xmm3, %xmm0
85 ; SSE-NEXT: ret{{[l|q]}}
87 ; AVX-LABEL: test_mm_blendv_pd:
89 ; AVX-NEXT: vblendvpd %xmm2, %xmm1, %xmm0, %xmm0
90 ; AVX-NEXT: ret{{[l|q]}}
91 %res = call <2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2)
94 declare <2 x double> @llvm.x86.sse41.blendvpd(<2 x double>, <2 x double>, <2 x double>) nounwind readnone
96 define <4 x float> @test_mm_blendv_ps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
97 ; SSE-LABEL: test_mm_blendv_ps:
99 ; SSE-NEXT: movaps %xmm0, %xmm3
100 ; SSE-NEXT: movaps %xmm2, %xmm0
101 ; SSE-NEXT: blendvps %xmm0, %xmm1, %xmm3
102 ; SSE-NEXT: movaps %xmm3, %xmm0
103 ; SSE-NEXT: ret{{[l|q]}}
105 ; AVX-LABEL: test_mm_blendv_ps:
107 ; AVX-NEXT: vblendvps %xmm2, %xmm1, %xmm0, %xmm0
108 ; AVX-NEXT: ret{{[l|q]}}
109 %res = call <4 x float> @llvm.x86.sse41.blendvps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2)
112 declare <4 x float> @llvm.x86.sse41.blendvps(<4 x float>, <4 x float>, <4 x float>) nounwind readnone
114 define <2 x double> @test_mm_ceil_pd(<2 x double> %a0) {
115 ; SSE-LABEL: test_mm_ceil_pd:
117 ; SSE-NEXT: roundpd $2, %xmm0, %xmm0
118 ; SSE-NEXT: ret{{[l|q]}}
120 ; AVX-LABEL: test_mm_ceil_pd:
122 ; AVX-NEXT: vroundpd $2, %xmm0, %xmm0
123 ; AVX-NEXT: ret{{[l|q]}}
124 %res = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %a0, i32 2)
125 ret <2 x double> %res
127 declare <2 x double> @llvm.x86.sse41.round.pd(<2 x double>, i32) nounwind readnone
129 define <4 x float> @test_mm_ceil_ps(<4 x float> %a0) {
130 ; SSE-LABEL: test_mm_ceil_ps:
132 ; SSE-NEXT: roundps $2, %xmm0, %xmm0
133 ; SSE-NEXT: ret{{[l|q]}}
135 ; AVX-LABEL: test_mm_ceil_ps:
137 ; AVX-NEXT: vroundps $2, %xmm0, %xmm0
138 ; AVX-NEXT: ret{{[l|q]}}
139 %res = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %a0, i32 2)
142 declare <4 x float> @llvm.x86.sse41.round.ps(<4 x float>, i32) nounwind readnone
144 define <2 x double> @test_mm_ceil_sd(<2 x double> %a0, <2 x double> %a1) {
145 ; SSE-LABEL: test_mm_ceil_sd:
147 ; SSE-NEXT: roundsd $2, %xmm1, %xmm0
148 ; SSE-NEXT: ret{{[l|q]}}
150 ; AVX-LABEL: test_mm_ceil_sd:
152 ; AVX-NEXT: vroundsd $2, %xmm1, %xmm0, %xmm0
153 ; AVX-NEXT: ret{{[l|q]}}
154 %res = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %a0, <2 x double> %a1, i32 2)
155 ret <2 x double> %res
157 declare <2 x double> @llvm.x86.sse41.round.sd(<2 x double>, <2 x double>, i32) nounwind readnone
159 define <4 x float> @test_mm_ceil_ss(<4 x float> %a0, <4 x float> %a1) {
160 ; SSE-LABEL: test_mm_ceil_ss:
162 ; SSE-NEXT: roundss $2, %xmm1, %xmm0
163 ; SSE-NEXT: ret{{[l|q]}}
165 ; AVX-LABEL: test_mm_ceil_ss:
167 ; AVX-NEXT: vroundss $2, %xmm1, %xmm0, %xmm0
168 ; AVX-NEXT: ret{{[l|q]}}
169 %res = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %a0, <4 x float> %a1, i32 2)
172 declare <4 x float> @llvm.x86.sse41.round.ss(<4 x float>, <4 x float>, i32) nounwind readnone
174 define <2 x i64> @test_mm_cmpeq_epi64(<2 x i64> %a0, <2 x i64> %a1) {
175 ; SSE-LABEL: test_mm_cmpeq_epi64:
177 ; SSE-NEXT: pcmpeqq %xmm1, %xmm0
178 ; SSE-NEXT: ret{{[l|q]}}
180 ; AVX1-LABEL: test_mm_cmpeq_epi64:
182 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
183 ; AVX1-NEXT: ret{{[l|q]}}
185 ; AVX512-LABEL: test_mm_cmpeq_epi64:
187 ; AVX512-NEXT: vpcmpeqq %xmm1, %xmm0, %k0
188 ; AVX512-NEXT: vpmovm2q %k0, %xmm0
189 ; AVX512-NEXT: ret{{[l|q]}}
190 %cmp = icmp eq <2 x i64> %a0, %a1
191 %res = sext <2 x i1> %cmp to <2 x i64>
195 define <2 x i64> @test_mm_cvtepi8_epi16(<2 x i64> %a0) {
196 ; SSE-LABEL: test_mm_cvtepi8_epi16:
198 ; SSE-NEXT: pmovsxbw %xmm0, %xmm0
199 ; SSE-NEXT: ret{{[l|q]}}
201 ; AVX-LABEL: test_mm_cvtepi8_epi16:
203 ; AVX-NEXT: vpmovsxbw %xmm0, %xmm0
204 ; AVX-NEXT: ret{{[l|q]}}
205 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
206 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
207 %sext = sext <8 x i8> %ext0 to <8 x i16>
208 %res = bitcast <8 x i16> %sext to <2 x i64>
212 define <2 x i64> @test_mm_cvtepi8_epi32(<2 x i64> %a0) {
213 ; SSE-LABEL: test_mm_cvtepi8_epi32:
215 ; SSE-NEXT: pmovsxbd %xmm0, %xmm0
216 ; SSE-NEXT: ret{{[l|q]}}
218 ; AVX-LABEL: test_mm_cvtepi8_epi32:
220 ; AVX-NEXT: vpmovsxbd %xmm0, %xmm0
221 ; AVX-NEXT: ret{{[l|q]}}
222 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
223 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
224 %sext = sext <4 x i8> %ext0 to <4 x i32>
225 %res = bitcast <4 x i32> %sext to <2 x i64>
229 define <2 x i64> @test_mm_cvtepi8_epi64(<2 x i64> %a0) {
230 ; SSE-LABEL: test_mm_cvtepi8_epi64:
232 ; SSE-NEXT: pmovsxbq %xmm0, %xmm0
233 ; SSE-NEXT: ret{{[l|q]}}
235 ; AVX-LABEL: test_mm_cvtepi8_epi64:
237 ; AVX-NEXT: vpmovsxbq %xmm0, %xmm0
238 ; AVX-NEXT: ret{{[l|q]}}
239 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
240 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <2 x i32> <i32 0, i32 1>
241 %sext = sext <2 x i8> %ext0 to <2 x i64>
245 define <2 x i64> @test_mm_cvtepi16_epi32(<2 x i64> %a0) {
246 ; SSE-LABEL: test_mm_cvtepi16_epi32:
248 ; SSE-NEXT: pmovsxwd %xmm0, %xmm0
249 ; SSE-NEXT: ret{{[l|q]}}
251 ; AVX-LABEL: test_mm_cvtepi16_epi32:
253 ; AVX-NEXT: vpmovsxwd %xmm0, %xmm0
254 ; AVX-NEXT: ret{{[l|q]}}
255 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
256 %ext0 = shufflevector <8 x i16> %arg0, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
257 %sext = sext <4 x i16> %ext0 to <4 x i32>
258 %res = bitcast <4 x i32> %sext to <2 x i64>
262 define <2 x i64> @test_mm_cvtepi16_epi64(<2 x i64> %a0) {
263 ; SSE-LABEL: test_mm_cvtepi16_epi64:
265 ; SSE-NEXT: pmovsxwq %xmm0, %xmm0
266 ; SSE-NEXT: ret{{[l|q]}}
268 ; AVX-LABEL: test_mm_cvtepi16_epi64:
270 ; AVX-NEXT: vpmovsxwq %xmm0, %xmm0
271 ; AVX-NEXT: ret{{[l|q]}}
272 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
273 %ext0 = shufflevector <8 x i16> %arg0, <8 x i16> undef, <2 x i32> <i32 0, i32 1>
274 %sext = sext <2 x i16> %ext0 to <2 x i64>
278 define <2 x i64> @test_mm_cvtepi32_epi64(<2 x i64> %a0) {
279 ; SSE-LABEL: test_mm_cvtepi32_epi64:
281 ; SSE-NEXT: pmovsxdq %xmm0, %xmm0
282 ; SSE-NEXT: ret{{[l|q]}}
284 ; AVX-LABEL: test_mm_cvtepi32_epi64:
286 ; AVX-NEXT: vpmovsxdq %xmm0, %xmm0
287 ; AVX-NEXT: ret{{[l|q]}}
288 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
289 %ext0 = shufflevector <4 x i32> %arg0, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
290 %sext = sext <2 x i32> %ext0 to <2 x i64>
294 define <2 x i64> @test_mm_cvtepu8_epi16(<2 x i64> %a0) {
295 ; SSE-LABEL: test_mm_cvtepu8_epi16:
297 ; SSE-NEXT: pmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
298 ; SSE-NEXT: ret{{[l|q]}}
300 ; AVX-LABEL: test_mm_cvtepu8_epi16:
302 ; AVX-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
303 ; AVX-NEXT: ret{{[l|q]}}
304 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
305 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
306 %sext = zext <8 x i8> %ext0 to <8 x i16>
307 %res = bitcast <8 x i16> %sext to <2 x i64>
311 define <2 x i64> @test_mm_cvtepu8_epi32(<2 x i64> %a0) {
312 ; SSE-LABEL: test_mm_cvtepu8_epi32:
314 ; SSE-NEXT: pmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
315 ; SSE-NEXT: ret{{[l|q]}}
317 ; AVX-LABEL: test_mm_cvtepu8_epi32:
319 ; AVX-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
320 ; AVX-NEXT: ret{{[l|q]}}
321 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
322 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
323 %sext = zext <4 x i8> %ext0 to <4 x i32>
324 %res = bitcast <4 x i32> %sext to <2 x i64>
328 define <2 x i64> @test_mm_cvtepu8_epi64(<2 x i64> %a0) {
329 ; SSE-LABEL: test_mm_cvtepu8_epi64:
331 ; SSE-NEXT: pmovzxbq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
332 ; SSE-NEXT: ret{{[l|q]}}
334 ; AVX-LABEL: test_mm_cvtepu8_epi64:
336 ; AVX-NEXT: vpmovzxbq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
337 ; AVX-NEXT: ret{{[l|q]}}
338 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
339 %ext0 = shufflevector <16 x i8> %arg0, <16 x i8> undef, <2 x i32> <i32 0, i32 1>
340 %sext = zext <2 x i8> %ext0 to <2 x i64>
344 define <2 x i64> @test_mm_cvtepu16_epi32(<2 x i64> %a0) {
345 ; SSE-LABEL: test_mm_cvtepu16_epi32:
347 ; SSE-NEXT: pmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
348 ; SSE-NEXT: ret{{[l|q]}}
350 ; AVX-LABEL: test_mm_cvtepu16_epi32:
352 ; AVX-NEXT: vpmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
353 ; AVX-NEXT: ret{{[l|q]}}
354 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
355 %ext0 = shufflevector <8 x i16> %arg0, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
356 %sext = zext <4 x i16> %ext0 to <4 x i32>
357 %res = bitcast <4 x i32> %sext to <2 x i64>
361 define <2 x i64> @test_mm_cvtepu16_epi64(<2 x i64> %a0) {
362 ; SSE-LABEL: test_mm_cvtepu16_epi64:
364 ; SSE-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
365 ; SSE-NEXT: ret{{[l|q]}}
367 ; AVX-LABEL: test_mm_cvtepu16_epi64:
369 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
370 ; AVX-NEXT: ret{{[l|q]}}
371 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
372 %ext0 = shufflevector <8 x i16> %arg0, <8 x i16> undef, <2 x i32> <i32 0, i32 1>
373 %sext = zext <2 x i16> %ext0 to <2 x i64>
377 define <2 x i64> @test_mm_cvtepu32_epi64(<2 x i64> %a0) {
378 ; SSE-LABEL: test_mm_cvtepu32_epi64:
380 ; SSE-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
381 ; SSE-NEXT: ret{{[l|q]}}
383 ; AVX-LABEL: test_mm_cvtepu32_epi64:
385 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
386 ; AVX-NEXT: ret{{[l|q]}}
387 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
388 %ext0 = shufflevector <4 x i32> %arg0, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
389 %sext = zext <2 x i32> %ext0 to <2 x i64>
393 define <2 x double> @test_mm_dp_pd(<2 x double> %a0, <2 x double> %a1) {
394 ; SSE-LABEL: test_mm_dp_pd:
396 ; SSE-NEXT: dppd $7, %xmm1, %xmm0
397 ; SSE-NEXT: ret{{[l|q]}}
399 ; AVX-LABEL: test_mm_dp_pd:
401 ; AVX-NEXT: vdppd $7, %xmm1, %xmm0, %xmm0
402 ; AVX-NEXT: ret{{[l|q]}}
403 %res = call <2 x double> @llvm.x86.sse41.dppd(<2 x double> %a0, <2 x double> %a1, i8 7)
404 ret <2 x double> %res
406 declare <2 x double> @llvm.x86.sse41.dppd(<2 x double>, <2 x double>, i8) nounwind readnone
408 define <4 x float> @test_mm_dp_ps(<4 x float> %a0, <4 x float> %a1) {
409 ; SSE-LABEL: test_mm_dp_ps:
411 ; SSE-NEXT: dpps $7, %xmm1, %xmm0
412 ; SSE-NEXT: ret{{[l|q]}}
414 ; AVX-LABEL: test_mm_dp_ps:
416 ; AVX-NEXT: vdpps $7, %xmm1, %xmm0, %xmm0
417 ; AVX-NEXT: ret{{[l|q]}}
418 %res = call <4 x float> @llvm.x86.sse41.dpps(<4 x float> %a0, <4 x float> %a1, i8 7)
421 declare <4 x float> @llvm.x86.sse41.dpps(<4 x float>, <4 x float>, i8) nounwind readnone
423 define i32 @test_mm_extract_epi8(<2 x i64> %a0) {
424 ; SSE-LABEL: test_mm_extract_epi8:
426 ; SSE-NEXT: pextrb $1, %xmm0, %eax
427 ; SSE-NEXT: movzbl %al, %eax
428 ; SSE-NEXT: ret{{[l|q]}}
430 ; AVX-LABEL: test_mm_extract_epi8:
432 ; AVX-NEXT: vpextrb $1, %xmm0, %eax
433 ; AVX-NEXT: movzbl %al, %eax
434 ; AVX-NEXT: ret{{[l|q]}}
435 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
436 %ext = extractelement <16 x i8> %arg0, i32 1
437 %res = zext i8 %ext to i32
441 define i32 @test_mm_extract_epi32(<2 x i64> %a0) {
442 ; SSE-LABEL: test_mm_extract_epi32:
444 ; SSE-NEXT: extractps $1, %xmm0, %eax
445 ; SSE-NEXT: ret{{[l|q]}}
447 ; AVX-LABEL: test_mm_extract_epi32:
449 ; AVX-NEXT: vextractps $1, %xmm0, %eax
450 ; AVX-NEXT: ret{{[l|q]}}
451 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
452 %ext = extractelement <4 x i32> %arg0, i32 1
456 define i64 @test_mm_extract_epi64(<2 x i64> %a0) {
457 ; X86-SSE-LABEL: test_mm_extract_epi64:
459 ; X86-SSE-NEXT: extractps $2, %xmm0, %eax
460 ; X86-SSE-NEXT: extractps $3, %xmm0, %edx
463 ; X86-AVX-LABEL: test_mm_extract_epi64:
465 ; X86-AVX-NEXT: vextractps $2, %xmm0, %eax
466 ; X86-AVX-NEXT: vextractps $3, %xmm0, %edx
469 ; X64-SSE-LABEL: test_mm_extract_epi64:
471 ; X64-SSE-NEXT: pextrq $1, %xmm0, %rax
474 ; X64-AVX-LABEL: test_mm_extract_epi64:
476 ; X64-AVX-NEXT: vpextrq $1, %xmm0, %rax
478 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
479 %ext = extractelement <2 x i64> %a0, i32 1
483 define i32 @test_mm_extract_ps(<4 x float> %a0) {
484 ; SSE-LABEL: test_mm_extract_ps:
486 ; SSE-NEXT: movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
487 ; SSE-NEXT: movd %xmm0, %eax
488 ; SSE-NEXT: ret{{[l|q]}}
490 ; AVX-LABEL: test_mm_extract_ps:
492 ; AVX-NEXT: vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
493 ; AVX-NEXT: vmovd %xmm0, %eax
494 ; AVX-NEXT: ret{{[l|q]}}
495 %ext = extractelement <4 x float> %a0, i32 1
496 %bc = bitcast float %ext to i32
500 define <2 x double> @test_mm_floor_pd(<2 x double> %a0) {
501 ; SSE-LABEL: test_mm_floor_pd:
503 ; SSE-NEXT: roundpd $1, %xmm0, %xmm0
504 ; SSE-NEXT: ret{{[l|q]}}
506 ; AVX-LABEL: test_mm_floor_pd:
508 ; AVX-NEXT: vroundpd $1, %xmm0, %xmm0
509 ; AVX-NEXT: ret{{[l|q]}}
510 %res = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %a0, i32 1)
511 ret <2 x double> %res
514 define <4 x float> @test_mm_floor_ps(<4 x float> %a0) {
515 ; SSE-LABEL: test_mm_floor_ps:
517 ; SSE-NEXT: roundps $1, %xmm0, %xmm0
518 ; SSE-NEXT: ret{{[l|q]}}
520 ; AVX-LABEL: test_mm_floor_ps:
522 ; AVX-NEXT: vroundps $1, %xmm0, %xmm0
523 ; AVX-NEXT: ret{{[l|q]}}
524 %res = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %a0, i32 1)
528 define <2 x double> @test_mm_floor_sd(<2 x double> %a0, <2 x double> %a1) {
529 ; SSE-LABEL: test_mm_floor_sd:
531 ; SSE-NEXT: roundsd $1, %xmm1, %xmm0
532 ; SSE-NEXT: ret{{[l|q]}}
534 ; AVX-LABEL: test_mm_floor_sd:
536 ; AVX-NEXT: vroundsd $1, %xmm1, %xmm0, %xmm0
537 ; AVX-NEXT: ret{{[l|q]}}
538 %res = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %a0, <2 x double> %a1, i32 1)
539 ret <2 x double> %res
542 define <4 x float> @test_mm_floor_ss(<4 x float> %a0, <4 x float> %a1) {
543 ; SSE-LABEL: test_mm_floor_ss:
545 ; SSE-NEXT: roundss $1, %xmm1, %xmm0
546 ; SSE-NEXT: ret{{[l|q]}}
548 ; AVX-LABEL: test_mm_floor_ss:
550 ; AVX-NEXT: vroundss $1, %xmm1, %xmm0, %xmm0
551 ; AVX-NEXT: ret{{[l|q]}}
552 %res = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %a0, <4 x float> %a1, i32 1)
556 define <2 x i64> @test_mm_insert_epi8(<2 x i64> %a0, i8 %a1) {
557 ; X86-SSE-LABEL: test_mm_insert_epi8:
559 ; X86-SSE-NEXT: movzbl {{[0-9]+}}(%esp), %eax
560 ; X86-SSE-NEXT: pinsrb $1, %eax, %xmm0
563 ; X86-AVX-LABEL: test_mm_insert_epi8:
565 ; X86-AVX-NEXT: movzbl {{[0-9]+}}(%esp), %eax
566 ; X86-AVX-NEXT: vpinsrb $1, %eax, %xmm0, %xmm0
569 ; X64-SSE-LABEL: test_mm_insert_epi8:
571 ; X64-SSE-NEXT: movzbl %dil, %eax
572 ; X64-SSE-NEXT: pinsrb $1, %eax, %xmm0
575 ; X64-AVX-LABEL: test_mm_insert_epi8:
577 ; X64-AVX-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0
579 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
580 %res = insertelement <16 x i8> %arg0, i8 %a1,i32 1
581 %bc = bitcast <16 x i8> %res to <2 x i64>
585 define <2 x i64> @test_mm_insert_epi32(<2 x i64> %a0, i32 %a1) {
586 ; X86-SSE-LABEL: test_mm_insert_epi32:
588 ; X86-SSE-NEXT: pinsrd $1, {{[0-9]+}}(%esp), %xmm0
591 ; X86-AVX-LABEL: test_mm_insert_epi32:
593 ; X86-AVX-NEXT: vpinsrd $1, {{[0-9]+}}(%esp), %xmm0, %xmm0
596 ; X64-SSE-LABEL: test_mm_insert_epi32:
598 ; X64-SSE-NEXT: pinsrd $1, %edi, %xmm0
601 ; X64-AVX-LABEL: test_mm_insert_epi32:
603 ; X64-AVX-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0
605 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
606 %res = insertelement <4 x i32> %arg0, i32 %a1,i32 1
607 %bc = bitcast <4 x i32> %res to <2 x i64>
611 define <2 x i64> @test_mm_insert_epi64(<2 x i64> %a0, i64 %a1) {
612 ; X86-SSE-LABEL: test_mm_insert_epi64:
614 ; X86-SSE-NEXT: pinsrd $2, {{[0-9]+}}(%esp), %xmm0
615 ; X86-SSE-NEXT: pinsrd $3, {{[0-9]+}}(%esp), %xmm0
618 ; X86-AVX-LABEL: test_mm_insert_epi64:
620 ; X86-AVX-NEXT: vpinsrd $2, {{[0-9]+}}(%esp), %xmm0, %xmm0
621 ; X86-AVX-NEXT: vpinsrd $3, {{[0-9]+}}(%esp), %xmm0, %xmm0
624 ; X64-SSE-LABEL: test_mm_insert_epi64:
626 ; X64-SSE-NEXT: pinsrq $1, %rdi, %xmm0
629 ; X64-AVX-LABEL: test_mm_insert_epi64:
631 ; X64-AVX-NEXT: vpinsrq $1, %rdi, %xmm0, %xmm0
633 %res = insertelement <2 x i64> %a0, i64 %a1,i32 1
637 define <4 x float> @test_mm_insert_ps(<4 x float> %a0, <4 x float> %a1) {
638 ; SSE-LABEL: test_mm_insert_ps:
640 ; SSE-NEXT: insertps {{.*#+}} xmm0 = xmm1[0],xmm0[1],zero,xmm0[3]
641 ; SSE-NEXT: ret{{[l|q]}}
643 ; AVX-LABEL: test_mm_insert_ps:
645 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm1[0],xmm0[1],zero,xmm0[3]
646 ; AVX-NEXT: ret{{[l|q]}}
647 %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a0, <4 x float> %a1, i8 4)
650 declare <4 x float> @llvm.x86.sse41.insertps(<4 x float>, <4 x float>, i8) nounwind readnone
652 define <2 x i64> @test_mm_max_epi8(<2 x i64> %a0, <2 x i64> %a1) {
653 ; SSE-LABEL: test_mm_max_epi8:
655 ; SSE-NEXT: pmaxsb %xmm1, %xmm0
656 ; SSE-NEXT: ret{{[l|q]}}
658 ; AVX-LABEL: test_mm_max_epi8:
660 ; AVX-NEXT: vpmaxsb %xmm1, %xmm0, %xmm0
661 ; AVX-NEXT: ret{{[l|q]}}
662 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
663 %arg1 = bitcast <2 x i64> %a1 to <16 x i8>
664 %sel = call <16 x i8> @llvm.smax.v16i8(<16 x i8> %arg0, <16 x i8> %arg1)
665 %bc = bitcast <16 x i8> %sel to <2 x i64>
668 declare <16 x i8> @llvm.smax.v16i8(<16 x i8>, <16 x i8>)
670 define <2 x i64> @test_mm_max_epi32(<2 x i64> %a0, <2 x i64> %a1) {
671 ; SSE-LABEL: test_mm_max_epi32:
673 ; SSE-NEXT: pmaxsd %xmm1, %xmm0
674 ; SSE-NEXT: ret{{[l|q]}}
676 ; AVX-LABEL: test_mm_max_epi32:
678 ; AVX-NEXT: vpmaxsd %xmm1, %xmm0, %xmm0
679 ; AVX-NEXT: ret{{[l|q]}}
680 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
681 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
682 %sel = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %arg0, <4 x i32> %arg1)
683 %bc = bitcast <4 x i32> %sel to <2 x i64>
686 declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>)
688 define <2 x i64> @test_mm_max_epu16(<2 x i64> %a0, <2 x i64> %a1) {
689 ; SSE-LABEL: test_mm_max_epu16:
691 ; SSE-NEXT: pmaxuw %xmm1, %xmm0
692 ; SSE-NEXT: ret{{[l|q]}}
694 ; AVX-LABEL: test_mm_max_epu16:
696 ; AVX-NEXT: vpmaxuw %xmm1, %xmm0, %xmm0
697 ; AVX-NEXT: ret{{[l|q]}}
698 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
699 %arg1 = bitcast <2 x i64> %a1 to <8 x i16>
700 %sel = call <8 x i16> @llvm.umax.v8i16(<8 x i16> %arg0, <8 x i16> %arg1)
701 %bc = bitcast <8 x i16> %sel to <2 x i64>
704 declare <8 x i16> @llvm.umax.v8i16(<8 x i16>, <8 x i16>)
706 define <2 x i64> @test_mm_max_epu32(<2 x i64> %a0, <2 x i64> %a1) {
707 ; SSE-LABEL: test_mm_max_epu32:
709 ; SSE-NEXT: pmaxud %xmm1, %xmm0
710 ; SSE-NEXT: ret{{[l|q]}}
712 ; AVX-LABEL: test_mm_max_epu32:
714 ; AVX-NEXT: vpmaxud %xmm1, %xmm0, %xmm0
715 ; AVX-NEXT: ret{{[l|q]}}
716 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
717 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
718 %sel = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %arg0, <4 x i32> %arg1)
719 %bc = bitcast <4 x i32> %sel to <2 x i64>
722 declare <4 x i32> @llvm.umax.v4i32(<4 x i32>, <4 x i32>)
724 define <2 x i64> @test_mm_min_epi8(<2 x i64> %a0, <2 x i64> %a1) {
725 ; SSE-LABEL: test_mm_min_epi8:
727 ; SSE-NEXT: pminsb %xmm1, %xmm0
728 ; SSE-NEXT: ret{{[l|q]}}
730 ; AVX-LABEL: test_mm_min_epi8:
732 ; AVX-NEXT: vpminsb %xmm1, %xmm0, %xmm0
733 ; AVX-NEXT: ret{{[l|q]}}
734 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
735 %arg1 = bitcast <2 x i64> %a1 to <16 x i8>
736 %sel = call <16 x i8> @llvm.smin.v16i8(<16 x i8> %arg0, <16 x i8> %arg1)
737 %bc = bitcast <16 x i8> %sel to <2 x i64>
740 declare <16 x i8> @llvm.smin.v16i8(<16 x i8>, <16 x i8>)
742 define <2 x i64> @test_mm_min_epi32(<2 x i64> %a0, <2 x i64> %a1) {
743 ; SSE-LABEL: test_mm_min_epi32:
745 ; SSE-NEXT: pminsd %xmm1, %xmm0
746 ; SSE-NEXT: ret{{[l|q]}}
748 ; AVX-LABEL: test_mm_min_epi32:
750 ; AVX-NEXT: vpminsd %xmm1, %xmm0, %xmm0
751 ; AVX-NEXT: ret{{[l|q]}}
752 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
753 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
754 %sel = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %arg0, <4 x i32> %arg1)
755 %bc = bitcast <4 x i32> %sel to <2 x i64>
758 declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>)
760 define <2 x i64> @test_mm_min_epu16(<2 x i64> %a0, <2 x i64> %a1) {
761 ; SSE-LABEL: test_mm_min_epu16:
763 ; SSE-NEXT: pminuw %xmm1, %xmm0
764 ; SSE-NEXT: ret{{[l|q]}}
766 ; AVX-LABEL: test_mm_min_epu16:
768 ; AVX-NEXT: vpminuw %xmm1, %xmm0, %xmm0
769 ; AVX-NEXT: ret{{[l|q]}}
770 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
771 %arg1 = bitcast <2 x i64> %a1 to <8 x i16>
772 %sel = call <8 x i16> @llvm.umin.v8i16(<8 x i16> %arg0, <8 x i16> %arg1)
773 %bc = bitcast <8 x i16> %sel to <2 x i64>
776 declare <8 x i16> @llvm.umin.v8i16(<8 x i16>, <8 x i16>)
778 define <2 x i64> @test_mm_min_epu32(<2 x i64> %a0, <2 x i64> %a1) {
779 ; SSE-LABEL: test_mm_min_epu32:
781 ; SSE-NEXT: pminud %xmm1, %xmm0
782 ; SSE-NEXT: ret{{[l|q]}}
784 ; AVX-LABEL: test_mm_min_epu32:
786 ; AVX-NEXT: vpminud %xmm1, %xmm0, %xmm0
787 ; AVX-NEXT: ret{{[l|q]}}
788 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
789 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
790 %sel = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %arg0, <4 x i32> %arg1)
791 %bc = bitcast <4 x i32> %sel to <2 x i64>
794 declare <4 x i32> @llvm.umin.v4i32(<4 x i32>, <4 x i32>)
796 define <2 x i64> @test_mm_minpos_epu16(<2 x i64> %a0) {
797 ; SSE-LABEL: test_mm_minpos_epu16:
799 ; SSE-NEXT: phminposuw %xmm0, %xmm0
800 ; SSE-NEXT: ret{{[l|q]}}
802 ; AVX-LABEL: test_mm_minpos_epu16:
804 ; AVX-NEXT: vphminposuw %xmm0, %xmm0
805 ; AVX-NEXT: ret{{[l|q]}}
806 %arg0 = bitcast <2 x i64> %a0 to <8 x i16>
807 %res = call <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16> %arg0)
808 %bc = bitcast <8 x i16> %res to <2 x i64>
811 declare <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16>) nounwind readnone
813 define <2 x i64> @test_mm_mpsadbw_epu8(<2 x i64> %a0, <2 x i64> %a1) {
814 ; SSE-LABEL: test_mm_mpsadbw_epu8:
816 ; SSE-NEXT: mpsadbw $1, %xmm1, %xmm0
817 ; SSE-NEXT: ret{{[l|q]}}
819 ; AVX-LABEL: test_mm_mpsadbw_epu8:
821 ; AVX-NEXT: vmpsadbw $1, %xmm1, %xmm0, %xmm0
822 ; AVX-NEXT: ret{{[l|q]}}
823 %arg0 = bitcast <2 x i64> %a0 to <16 x i8>
824 %arg1 = bitcast <2 x i64> %a1 to <16 x i8>
825 %res = call <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8> %arg0, <16 x i8> %arg1, i8 1)
826 %bc = bitcast <8 x i16> %res to <2 x i64>
829 declare <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8>, <16 x i8>, i8) nounwind readnone
831 define <2 x i64> @test_mm_mul_epi32(<2 x i64> %a0, <2 x i64> %a1) {
832 ; SSE-LABEL: test_mm_mul_epi32:
834 ; SSE-NEXT: pmuldq %xmm1, %xmm0
835 ; SSE-NEXT: ret{{[l|q]}}
837 ; AVX1-LABEL: test_mm_mul_epi32:
839 ; AVX1-NEXT: vpmuldq %xmm1, %xmm0, %xmm0
840 ; AVX1-NEXT: ret{{[l|q]}}
842 ; AVX512-LABEL: test_mm_mul_epi32:
844 ; AVX512-NEXT: vpsllq $32, %xmm0, %xmm0
845 ; AVX512-NEXT: vpsraq $32, %xmm0, %xmm0
846 ; AVX512-NEXT: vpsllq $32, %xmm1, %xmm1
847 ; AVX512-NEXT: vpsraq $32, %xmm1, %xmm1
848 ; AVX512-NEXT: vpmullq %xmm1, %xmm0, %xmm0
849 ; AVX512-NEXT: ret{{[l|q]}}
850 %A = shl <2 x i64> %a0, <i64 32, i64 32>
851 %A1 = ashr exact <2 x i64> %A, <i64 32, i64 32>
852 %B = shl <2 x i64> %a1, <i64 32, i64 32>
853 %B1 = ashr exact <2 x i64> %B, <i64 32, i64 32>
854 %res = mul nsw <2 x i64> %A1, %B1
858 define <2 x i64> @test_mm_mullo_epi32(<2 x i64> %a0, <2 x i64> %a1) {
859 ; SSE-LABEL: test_mm_mullo_epi32:
861 ; SSE-NEXT: pmulld %xmm1, %xmm0
862 ; SSE-NEXT: ret{{[l|q]}}
864 ; AVX-LABEL: test_mm_mullo_epi32:
866 ; AVX-NEXT: vpmulld %xmm1, %xmm0, %xmm0
867 ; AVX-NEXT: ret{{[l|q]}}
868 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
869 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
870 %res = mul <4 x i32> %arg0, %arg1
871 %bc = bitcast <4 x i32> %res to <2 x i64>
875 define <2 x i64> @test_mm_packus_epi32(<2 x i64> %a0, <2 x i64> %a1) {
876 ; SSE-LABEL: test_mm_packus_epi32:
878 ; SSE-NEXT: packusdw %xmm1, %xmm0
879 ; SSE-NEXT: ret{{[l|q]}}
881 ; AVX-LABEL: test_mm_packus_epi32:
883 ; AVX-NEXT: vpackusdw %xmm1, %xmm0, %xmm0
884 ; AVX-NEXT: ret{{[l|q]}}
885 %arg0 = bitcast <2 x i64> %a0 to <4 x i32>
886 %arg1 = bitcast <2 x i64> %a1 to <4 x i32>
887 %res = call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %arg0, <4 x i32> %arg1)
888 %bc = bitcast <8 x i16> %res to <2 x i64>
891 declare <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32>, <4 x i32>) nounwind readnone
893 define <2 x double> @test_mm_round_pd(<2 x double> %a0) {
894 ; SSE-LABEL: test_mm_round_pd:
896 ; SSE-NEXT: roundpd $4, %xmm0, %xmm0
897 ; SSE-NEXT: ret{{[l|q]}}
899 ; AVX-LABEL: test_mm_round_pd:
901 ; AVX-NEXT: vroundpd $4, %xmm0, %xmm0
902 ; AVX-NEXT: ret{{[l|q]}}
903 %res = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %a0, i32 4)
904 ret <2 x double> %res
907 define <4 x float> @test_mm_round_ps(<4 x float> %a0) {
908 ; SSE-LABEL: test_mm_round_ps:
910 ; SSE-NEXT: roundps $4, %xmm0, %xmm0
911 ; SSE-NEXT: ret{{[l|q]}}
913 ; AVX-LABEL: test_mm_round_ps:
915 ; AVX-NEXT: vroundps $4, %xmm0, %xmm0
916 ; AVX-NEXT: ret{{[l|q]}}
917 %res = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %a0, i32 4)
921 define <2 x double> @test_mm_round_sd(<2 x double> %a0, <2 x double> %a1) {
922 ; SSE-LABEL: test_mm_round_sd:
924 ; SSE-NEXT: roundsd $4, %xmm1, %xmm0
925 ; SSE-NEXT: ret{{[l|q]}}
927 ; AVX-LABEL: test_mm_round_sd:
929 ; AVX-NEXT: vroundsd $4, %xmm1, %xmm0, %xmm0
930 ; AVX-NEXT: ret{{[l|q]}}
931 %res = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %a0, <2 x double> %a1, i32 4)
932 ret <2 x double> %res
935 define <4 x float> @test_mm_round_ss(<4 x float> %a0, <4 x float> %a1) {
936 ; SSE-LABEL: test_mm_round_ss:
938 ; SSE-NEXT: roundss $4, %xmm1, %xmm0
939 ; SSE-NEXT: ret{{[l|q]}}
941 ; AVX-LABEL: test_mm_round_ss:
943 ; AVX-NEXT: vroundss $4, %xmm1, %xmm0, %xmm0
944 ; AVX-NEXT: ret{{[l|q]}}
945 %res = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %a0, <4 x float> %a1, i32 4)
949 define <2 x i64> @test_mm_stream_load_si128(ptr %a0) {
950 ; X86-SSE-LABEL: test_mm_stream_load_si128:
952 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
953 ; X86-SSE-NEXT: movntdqa (%eax), %xmm0
956 ; X86-AVX-LABEL: test_mm_stream_load_si128:
958 ; X86-AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
959 ; X86-AVX-NEXT: vmovntdqa (%eax), %xmm0
962 ; X64-SSE-LABEL: test_mm_stream_load_si128:
964 ; X64-SSE-NEXT: movntdqa (%rdi), %xmm0
967 ; X64-AVX-LABEL: test_mm_stream_load_si128:
969 ; X64-AVX-NEXT: vmovntdqa (%rdi), %xmm0
971 %res = call <2 x i64> @llvm.x86.sse41.movntdqa(ptr %a0)
974 declare <2 x i64> @llvm.x86.sse41.movntdqa(ptr) nounwind readnone
976 define i32 @test_mm_test_all_ones(<2 x i64> %a0) {
977 ; SSE-LABEL: test_mm_test_all_ones:
979 ; SSE-NEXT: pcmpeqd %xmm1, %xmm1
980 ; SSE-NEXT: xorl %eax, %eax
981 ; SSE-NEXT: ptest %xmm1, %xmm0
983 ; SSE-NEXT: ret{{[l|q]}}
985 ; AVX-LABEL: test_mm_test_all_ones:
987 ; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
988 ; AVX-NEXT: xorl %eax, %eax
989 ; AVX-NEXT: vptest %xmm1, %xmm0
991 ; AVX-NEXT: ret{{[l|q]}}
992 %res = call i32 @llvm.x86.sse41.ptestc(<2 x i64> %a0, <2 x i64> <i64 -1, i64 -1>)
995 declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
997 define i32 @test_mm_test_all_zeros(<2 x i64> %a0, <2 x i64> %a1) {
998 ; SSE-LABEL: test_mm_test_all_zeros:
1000 ; SSE-NEXT: xorl %eax, %eax
1001 ; SSE-NEXT: ptest %xmm1, %xmm0
1002 ; SSE-NEXT: sete %al
1003 ; SSE-NEXT: ret{{[l|q]}}
1005 ; AVX-LABEL: test_mm_test_all_zeros:
1007 ; AVX-NEXT: xorl %eax, %eax
1008 ; AVX-NEXT: vptest %xmm1, %xmm0
1009 ; AVX-NEXT: sete %al
1010 ; AVX-NEXT: ret{{[l|q]}}
1011 %res = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %a0, <2 x i64> %a1)
1014 declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
1016 define i32 @test_mm_test_mix_ones_zeros(<2 x i64> %a0, <2 x i64> %a1) {
1017 ; SSE-LABEL: test_mm_test_mix_ones_zeros:
1019 ; SSE-NEXT: xorl %eax, %eax
1020 ; SSE-NEXT: ptest %xmm1, %xmm0
1021 ; SSE-NEXT: seta %al
1022 ; SSE-NEXT: ret{{[l|q]}}
1024 ; AVX-LABEL: test_mm_test_mix_ones_zeros:
1026 ; AVX-NEXT: xorl %eax, %eax
1027 ; AVX-NEXT: vptest %xmm1, %xmm0
1028 ; AVX-NEXT: seta %al
1029 ; AVX-NEXT: ret{{[l|q]}}
1030 %res = call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %a0, <2 x i64> %a1)
1033 declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
1035 define i32 @test_mm_testc_si128(<2 x i64> %a0, <2 x i64> %a1) {
1036 ; SSE-LABEL: test_mm_testc_si128:
1038 ; SSE-NEXT: xorl %eax, %eax
1039 ; SSE-NEXT: ptest %xmm1, %xmm0
1040 ; SSE-NEXT: setb %al
1041 ; SSE-NEXT: ret{{[l|q]}}
1043 ; AVX-LABEL: test_mm_testc_si128:
1045 ; AVX-NEXT: xorl %eax, %eax
1046 ; AVX-NEXT: vptest %xmm1, %xmm0
1047 ; AVX-NEXT: setb %al
1048 ; AVX-NEXT: ret{{[l|q]}}
1049 %res = call i32 @llvm.x86.sse41.ptestc(<2 x i64> %a0, <2 x i64> %a1)
1053 define i32 @test_mm_testnzc_si128(<2 x i64> %a0, <2 x i64> %a1) {
1054 ; SSE-LABEL: test_mm_testnzc_si128:
1056 ; SSE-NEXT: xorl %eax, %eax
1057 ; SSE-NEXT: ptest %xmm1, %xmm0
1058 ; SSE-NEXT: seta %al
1059 ; SSE-NEXT: ret{{[l|q]}}
1061 ; AVX-LABEL: test_mm_testnzc_si128:
1063 ; AVX-NEXT: xorl %eax, %eax
1064 ; AVX-NEXT: vptest %xmm1, %xmm0
1065 ; AVX-NEXT: seta %al
1066 ; AVX-NEXT: ret{{[l|q]}}
1067 %res = call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %a0, <2 x i64> %a1)
1071 define i32 @test_mm_testz_si128(<2 x i64> %a0, <2 x i64> %a1) {
1072 ; SSE-LABEL: test_mm_testz_si128:
1074 ; SSE-NEXT: xorl %eax, %eax
1075 ; SSE-NEXT: ptest %xmm1, %xmm0
1076 ; SSE-NEXT: sete %al
1077 ; SSE-NEXT: ret{{[l|q]}}
1079 ; AVX-LABEL: test_mm_testz_si128:
1081 ; AVX-NEXT: xorl %eax, %eax
1082 ; AVX-NEXT: vptest %xmm1, %xmm0
1083 ; AVX-NEXT: sete %al
1084 ; AVX-NEXT: ret{{[l|q]}}
1085 %res = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %a0, <2 x i64> %a1)