From a861f2e16ee6a0be173718c7cf98f73a0979aff4 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 19 May 2016 10:58:54 +0000 Subject: [PATCH] [X86][SSE2] Added _mm_cast* and _mm_set* tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270041 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/sse2-intrinsics-fast-isel.ll | 720 ++++++++++++++++++ 1 file changed, 720 insertions(+) diff --git a/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll b/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll index 9f80fe2ce2aa..097949c82713 100644 --- a/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll +++ b/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll @@ -308,6 +308,78 @@ define <2 x i64> @test_mm_bsrli_si128(<2 x i64> %a0) nounwind { ret <2 x i64> %bc } +define <4 x float> @test_mm_castpd_ps(<2 x double> %a0) nounwind { +; X32-LABEL: test_mm_castpd_ps: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castpd_ps: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <2 x double> %a0 to <4 x float> + ret <4 x float> %res +} + +define <2 x i64> @test_mm_castpd_si128(<2 x double> %a0) nounwind { +; X32-LABEL: test_mm_castpd_si128: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castpd_si128: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <2 x double> %a0 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x double> @test_mm_castps_pd(<4 x float> %a0) nounwind { +; X32-LABEL: test_mm_castps_pd: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castps_pd: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <4 x float> %a0 to <2 x double> + ret <2 x double> %res +} + +define <2 x i64> @test_mm_castps_si128(<4 x float> %a0) nounwind { +; X32-LABEL: test_mm_castps_si128: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castps_si128: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <4 x float> %a0 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x double> @test_mm_castsi128_pd(<2 x i64> %a0) nounwind { +; X32-LABEL: test_mm_castsi128_pd: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castsi128_pd: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <2 x i64> %a0 to <2 x double> + ret <2 x double> %res +} + +define <4 x float> @test_mm_castsi128_ps(<2 x i64> %a0) nounwind { +; X32-LABEL: test_mm_castsi128_ps: +; X32: # BB#0: +; X32-NEXT: retl +; +; X64-LABEL: test_mm_castsi128_ps: +; X64: # BB#0: +; X64-NEXT: retq + %res = bitcast <2 x i64> %a0 to <4 x float> + ret <4 x float> %res +} + define void @test_mm_clflush(i8* %a0) nounwind { ; X32-LABEL: test_mm_clflush: ; X32: # BB#0: @@ -1903,6 +1975,654 @@ define <2 x i64> @test_mm_sad_epu8(<2 x i64> %a0, <2 x i64> %a1) nounwind { } declare <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8>, <16 x i8>) nounwind readnone +define <2 x i64> @test_mm_set_epi8(i8 %a0, i8 %a1, i8 %a2, i8 %a3, i8 %a4, i8 %a5, i8 %a6, i8 %a7, i8 %a8, i8 %a9, i8 %a10, i8 %a11, i8 %a12, i8 %a13, i8 %a14, i8 %a15) nounwind { +; X32-LABEL: test_mm_set_epi8: +; X32: # BB#0: +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm4 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_epi8: +; X64: # BB#0: +; X64-NEXT: movzbl %dil, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X64-NEXT: movzbl %r8b, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7] +; X64-NEXT: movzbl %dl, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm3 +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7] +; X64-NEXT: movzbl %sil, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: movzbl %r9b, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm3 +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7] +; X64-NEXT: movzbl %cl, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm4 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X64-NEXT: retq + %res0 = insertelement <16 x i8> undef, i8 %a15, i32 0 + %res1 = insertelement <16 x i8> %res0, i8 %a14, i32 1 + %res2 = insertelement <16 x i8> %res1, i8 %a13, i32 2 + %res3 = insertelement <16 x i8> %res2, i8 %a12, i32 3 + %res4 = insertelement <16 x i8> %res3, i8 %a11, i32 4 + %res5 = insertelement <16 x i8> %res4, i8 %a10, i32 5 + %res6 = insertelement <16 x i8> %res5, i8 %a9 , i32 6 + %res7 = insertelement <16 x i8> %res6, i8 %a8 , i32 7 + %res8 = insertelement <16 x i8> %res7, i8 %a7 , i32 8 + %res9 = insertelement <16 x i8> %res8, i8 %a6 , i32 9 + %res10 = insertelement <16 x i8> %res9, i8 %a5 , i32 10 + %res11 = insertelement <16 x i8> %res10, i8 %a4 , i32 11 + %res12 = insertelement <16 x i8> %res11, i8 %a3 , i32 12 + %res13 = insertelement <16 x i8> %res12, i8 %a2 , i32 13 + %res14 = insertelement <16 x i8> %res13, i8 %a1 , i32 14 + %res15 = insertelement <16 x i8> %res14, i8 %a0 , i32 15 + %res = bitcast <16 x i8> %res15 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_set_epi16(i16 %a0, i16 %a1, i16 %a2, i16 %a3, i16 %a4, i16 %a5, i16 %a6, i16 %a7) nounwind { +; X32-LABEL: test_mm_set_epi16: +; X32: # BB#0: +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm4 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm5 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm6 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm7 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1],xmm0[2],xmm6[2],xmm0[3],xmm6[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_epi16: +; X64: # BB#0: +; X64-NEXT: movw {{[0-9]+}}(%rsp), %r10w +; X64-NEXT: movw {{[0-9]+}}(%rsp), %ax +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: movd %r8d, %xmm1 +; X64-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3] +; X64-NEXT: movd %edx, %xmm0 +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3] +; X64-NEXT: movd %esi, %xmm0 +; X64-NEXT: movd %r9d, %xmm1 +; X64-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3] +; X64-NEXT: movd %ecx, %xmm3 +; X64-NEXT: movd %r10d, %xmm0 +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3] +; X64-NEXT: retq + %res0 = insertelement <8 x i16> undef, i16 %a7, i32 0 + %res1 = insertelement <8 x i16> %res0, i16 %a6, i32 1 + %res2 = insertelement <8 x i16> %res1, i16 %a5, i32 2 + %res3 = insertelement <8 x i16> %res2, i16 %a4, i32 3 + %res4 = insertelement <8 x i16> %res3, i16 %a3, i32 4 + %res5 = insertelement <8 x i16> %res4, i16 %a2, i32 5 + %res6 = insertelement <8 x i16> %res5, i16 %a1, i32 6 + %res7 = insertelement <8 x i16> %res6, i16 %a0, i32 7 + %res = bitcast <8 x i16> %res7 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_set_epi32(i32 %a0, i32 %a1, i32 %a2, i32 %a3) nounwind { +; X32-LABEL: test_mm_set_epi32: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] +; X32-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_epi32: +; X64: # BB#0: +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: movd %edx, %xmm1 +; X64-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] +; X64-NEXT: movd %esi, %xmm2 +; X64-NEXT: movd %ecx, %xmm0 +; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X64-NEXT: retq + %res0 = insertelement <4 x i32> undef, i32 %a3, i32 0 + %res1 = insertelement <4 x i32> %res0, i32 %a2, i32 1 + %res2 = insertelement <4 x i32> %res1, i32 %a1, i32 2 + %res3 = insertelement <4 x i32> %res2, i32 %a0, i32 3 + %res = bitcast <4 x i32> %res3 to <2 x i64> + ret <2 x i64> %res +} + +; TODO test_mm_set_epi64 + +define <2 x i64> @test_mm_set_epi64x(i64 %a0, i64 %a1) nounwind { +; X32-LABEL: test_mm_set_epi64x: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1] +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_epi64x: +; X64: # BB#0: +; X64-NEXT: movd %rdi, %xmm1 +; X64-NEXT: movd %rsi, %xmm0 +; X64-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0] +; X64-NEXT: retq + %res0 = insertelement <2 x i64> undef, i64 %a1, i32 0 + %res1 = insertelement <2 x i64> %res0, i64 %a0, i32 1 + ret <2 x i64> %res1 +} + +define <2 x double> @test_mm_set_pd(double %a0, double %a1) nounwind { +; X32-LABEL: test_mm_set_pd: +; X32: # BB#0: +; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero +; X32-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero +; X32-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_pd: +; X64: # BB#0: +; X64-NEXT: unpcklpd {{.*#+}} xmm1 = xmm1[0],xmm0[0] +; X64-NEXT: movapd %xmm1, %xmm0 +; X64-NEXT: retq + %res0 = insertelement <2 x double> undef, double %a1, i32 0 + %res1 = insertelement <2 x double> %res0, double %a0, i32 1 + ret <2 x double> %res1 +} + +define <2 x double> @test_mm_set_sd(double %a0) nounwind { +; X32-LABEL: test_mm_set_sd: +; X32: # BB#0: +; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero +; X32-NEXT: movq {{.*#+}} xmm0 = xmm0[0],zero +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set_sd: +; X64: # BB#0: +; X64-NEXT: movq {{.*#+}} xmm0 = xmm0[0],zero +; X64-NEXT: retq + %res0 = insertelement <2 x double> undef, double %a0, i32 0 + %res1 = insertelement <2 x double> %res0, double 0.0, i32 1 + ret <2 x double> %res1 +} + +define <2 x i64> @test_mm_set1_epi8(i8 %a0) nounwind { +; X32-LABEL: test_mm_set1_epi8: +; X32: # BB#0: +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7] +; X32-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7] +; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set1_epi8: +; X64: # BB#0: +; X64-NEXT: movzbl %dil, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7] +; X64-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7] +; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1] +; X64-NEXT: retq + %res0 = insertelement <16 x i8> undef, i8 %a0, i32 0 + %res1 = insertelement <16 x i8> %res0, i8 %a0, i32 1 + %res2 = insertelement <16 x i8> %res1, i8 %a0, i32 2 + %res3 = insertelement <16 x i8> %res2, i8 %a0, i32 3 + %res4 = insertelement <16 x i8> %res3, i8 %a0, i32 4 + %res5 = insertelement <16 x i8> %res4, i8 %a0, i32 5 + %res6 = insertelement <16 x i8> %res5, i8 %a0, i32 6 + %res7 = insertelement <16 x i8> %res6, i8 %a0, i32 7 + %res8 = insertelement <16 x i8> %res7, i8 %a0, i32 8 + %res9 = insertelement <16 x i8> %res8, i8 %a0, i32 9 + %res10 = insertelement <16 x i8> %res9, i8 %a0, i32 10 + %res11 = insertelement <16 x i8> %res10, i8 %a0, i32 11 + %res12 = insertelement <16 x i8> %res11, i8 %a0, i32 12 + %res13 = insertelement <16 x i8> %res12, i8 %a0, i32 13 + %res14 = insertelement <16 x i8> %res13, i8 %a0, i32 14 + %res15 = insertelement <16 x i8> %res14, i8 %a0, i32 15 + %res = bitcast <16 x i8> %res15 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_set1_epi16(i16 %a0) nounwind { +; X32-LABEL: test_mm_set1_epi16: +; X32: # BB#0: +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7] +; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set1_epi16: +; X64: # BB#0: +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7] +; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1] +; X64-NEXT: retq + %res0 = insertelement <8 x i16> undef, i16 %a0, i32 0 + %res1 = insertelement <8 x i16> %res0, i16 %a0, i32 1 + %res2 = insertelement <8 x i16> %res1, i16 %a0, i32 2 + %res3 = insertelement <8 x i16> %res2, i16 %a0, i32 3 + %res4 = insertelement <8 x i16> %res3, i16 %a0, i32 4 + %res5 = insertelement <8 x i16> %res4, i16 %a0, i32 5 + %res6 = insertelement <8 x i16> %res5, i16 %a0, i32 6 + %res7 = insertelement <8 x i16> %res6, i16 %a0, i32 7 + %res = bitcast <8 x i16> %res7 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_set1_epi32(i32 %a0) nounwind { +; X32-LABEL: test_mm_set1_epi32: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set1_epi32: +; X64: # BB#0: +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0] +; X64-NEXT: retq + %res0 = insertelement <4 x i32> undef, i32 %a0, i32 0 + %res1 = insertelement <4 x i32> %res0, i32 %a0, i32 1 + %res2 = insertelement <4 x i32> %res1, i32 %a0, i32 2 + %res3 = insertelement <4 x i32> %res2, i32 %a0, i32 3 + %res = bitcast <4 x i32> %res3 to <2 x i64> + ret <2 x i64> %res +} + +; TODO test_mm_set1_epi64 + +define <2 x i64> @test_mm_set1_epi64x(i64 %a0) nounwind { +; X32-LABEL: test_mm_set1_epi64x: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1] +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1] +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set1_epi64x: +; X64: # BB#0: +; X64-NEXT: movd %rdi, %xmm0 +; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1] +; X64-NEXT: retq + %res0 = insertelement <2 x i64> undef, i64 %a0, i32 0 + %res1 = insertelement <2 x i64> %res0, i64 %a0, i32 1 + ret <2 x i64> %res1 +} + +define <2 x double> @test_mm_set1_pd(double %a0) nounwind { +; X32-LABEL: test_mm_set1_pd: +; X32: # BB#0: +; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero +; X32-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0,0] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_set1_pd: +; X64: # BB#0: +; X64-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0,0] +; X64-NEXT: retq + %res0 = insertelement <2 x double> undef, double %a0, i32 0 + %res1 = insertelement <2 x double> %res0, double %a0, i32 1 + ret <2 x double> %res1 +} + +define <2 x i64> @test_mm_setr_epi8(i8 %a0, i8 %a1, i8 %a2, i8 %a3, i8 %a4, i8 %a5, i8 %a6, i8 %a7, i8 %a8, i8 %a9, i8 %a10, i8 %a11, i8 %a12, i8 %a13, i8 %a14, i8 %a15) nounwind { +; X32-LABEL: test_mm_setr_epi8: +; X32: # BB#0: +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm4 +; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7] +; X32-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_setr_epi8: +; X64: # BB#0: +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl %cl, %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl %r9b, %eax +; X64-NEXT: movd %eax, %xmm3 +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl %sil, %eax +; X64-NEXT: movd %eax, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl %dl, %eax +; X64-NEXT: movd %eax, %xmm3 +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movzbl %r8b, %eax +; X64-NEXT: movd %eax, %xmm2 +; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7] +; X64-NEXT: movzbl {{[0-9]+}}(%rsp), %eax +; X64-NEXT: movd %eax, %xmm4 +; X64-NEXT: movzbl %dil, %eax +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7] +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X64-NEXT: retq + %res0 = insertelement <16 x i8> undef, i8 %a0 , i32 0 + %res1 = insertelement <16 x i8> %res0, i8 %a1 , i32 1 + %res2 = insertelement <16 x i8> %res1, i8 %a2 , i32 2 + %res3 = insertelement <16 x i8> %res2, i8 %a3 , i32 3 + %res4 = insertelement <16 x i8> %res3, i8 %a4 , i32 4 + %res5 = insertelement <16 x i8> %res4, i8 %a5 , i32 5 + %res6 = insertelement <16 x i8> %res5, i8 %a6 , i32 6 + %res7 = insertelement <16 x i8> %res6, i8 %a7 , i32 7 + %res8 = insertelement <16 x i8> %res7, i8 %a8 , i32 8 + %res9 = insertelement <16 x i8> %res8, i8 %a9 , i32 9 + %res10 = insertelement <16 x i8> %res9, i8 %a10, i32 10 + %res11 = insertelement <16 x i8> %res10, i8 %a11, i32 11 + %res12 = insertelement <16 x i8> %res11, i8 %a12, i32 12 + %res13 = insertelement <16 x i8> %res12, i8 %a13, i32 13 + %res14 = insertelement <16 x i8> %res13, i8 %a14, i32 14 + %res15 = insertelement <16 x i8> %res14, i8 %a15, i32 15 + %res = bitcast <16 x i8> %res15 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_setr_epi16(i16 %a0, i16 %a1, i16 %a2, i16 %a3, i16 %a4, i16 %a5, i16 %a6, i16 %a7) nounwind { +; X32-LABEL: test_mm_setr_epi16: +; X32: # BB#0: +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm1 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm2 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm3 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm4 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm5 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm6 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm7 +; X32-NEXT: movw {{[0-9]+}}(%esp), %ax +; X32-NEXT: movd %eax, %xmm0 +; X32-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1],xmm0[2],xmm6[2],xmm0[3],xmm6[3] +; X32-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_setr_epi16: +; X64: # BB#0: +; X64-NEXT: movw {{[0-9]+}}(%rsp), %ax +; X64-NEXT: movw {{[0-9]+}}(%rsp), %r10w +; X64-NEXT: movd %eax, %xmm0 +; X64-NEXT: movd %ecx, %xmm1 +; X64-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3] +; X64-NEXT: movd %r9d, %xmm0 +; X64-NEXT: movd %esi, %xmm2 +; X64-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3] +; X64-NEXT: movd %r10d, %xmm0 +; X64-NEXT: movd %edx, %xmm1 +; X64-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3] +; X64-NEXT: movd %r8d, %xmm3 +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3] +; X64-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3] +; X64-NEXT: retq + %res0 = insertelement <8 x i16> undef, i16 %a0, i32 0 + %res1 = insertelement <8 x i16> %res0, i16 %a1, i32 1 + %res2 = insertelement <8 x i16> %res1, i16 %a2, i32 2 + %res3 = insertelement <8 x i16> %res2, i16 %a3, i32 3 + %res4 = insertelement <8 x i16> %res3, i16 %a4, i32 4 + %res5 = insertelement <8 x i16> %res4, i16 %a5, i32 5 + %res6 = insertelement <8 x i16> %res5, i16 %a6, i32 6 + %res7 = insertelement <8 x i16> %res6, i16 %a7, i32 7 + %res = bitcast <8 x i16> %res7 to <2 x i64> + ret <2 x i64> %res +} + +define <2 x i64> @test_mm_setr_epi32(i32 %a0, i32 %a1, i32 %a2, i32 %a3) nounwind { +; X32-LABEL: test_mm_setr_epi32: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] +; X32-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_setr_epi32: +; X64: # BB#0: +; X64-NEXT: movd %ecx, %xmm0 +; X64-NEXT: movd %esi, %xmm1 +; X64-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1] +; X64-NEXT: movd %edx, %xmm2 +; X64-NEXT: movd %edi, %xmm0 +; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X64-NEXT: retq + %res0 = insertelement <4 x i32> undef, i32 %a0, i32 0 + %res1 = insertelement <4 x i32> %res0, i32 %a1, i32 1 + %res2 = insertelement <4 x i32> %res1, i32 %a2, i32 2 + %res3 = insertelement <4 x i32> %res2, i32 %a3, i32 3 + %res = bitcast <4 x i32> %res3 to <2 x i64> + ret <2 x i64> %res +} + +; TODO test_mm_setr_epi64 + +define <2 x i64> @test_mm_setr_epi64x(i64 %a0, i64 %a1) nounwind { +; X32-LABEL: test_mm_setr_epi64x: +; X32: # BB#0: +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] +; X32-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero +; X32-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero +; X32-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1] +; X32-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_setr_epi64x: +; X64: # BB#0: +; X64-NEXT: movd %rsi, %xmm1 +; X64-NEXT: movd %rdi, %xmm0 +; X64-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0] +; X64-NEXT: retq + %res0 = insertelement <2 x i64> undef, i64 %a0, i32 0 + %res1 = insertelement <2 x i64> %res0, i64 %a1, i32 1 + ret <2 x i64> %res1 +} + +define <2 x double> @test_mm_setr_pd(double %a0, double %a1) nounwind { +; X32-LABEL: test_mm_setr_pd: +; X32: # BB#0: +; X32-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero +; X32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero +; X32-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0] +; X32-NEXT: retl +; +; X64-LABEL: test_mm_setr_pd: +; X64: # BB#0: +; X64-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0] +; X64-NEXT: retq + %res0 = insertelement <2 x double> undef, double %a0, i32 0 + %res1 = insertelement <2 x double> %res0, double %a1, i32 1 + ret <2 x double> %res1 +} + define <2 x double> @test_mm_setzero_pd() { ; X32-LABEL: test_mm_setzero_pd: ; X32: # BB#0: