1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=ALL --check-prefix=SSE2
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse4.1 | FileCheck %s --check-prefix=ALL --check-prefix=SSE41
4 define <4 x i32> @a(<4 x i32> %i) nounwind {
6 ; SSE2: movdqa {{.*}}, %[[X1:xmm[0-9]+]]
7 ; SSE2-NEXT: pshufd {{.*}} # [[X2:xmm[0-9]+]] = xmm0[1,0,3,0]
8 ; SSE2-NEXT: pmuludq %[[X1]], %xmm0
9 ; SSE2-NEXT: pmuludq %[[X1]], %[[X2]]
10 ; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],[[X2]][0,2]
11 ; SSE2-NEXT: pshufd {{.*}} # xmm0 = xmm0[0,2,1,3]
18 %A = mul <4 x i32> %i, < i32 117, i32 117, i32 117, i32 117 >
22 define <2 x i64> @b(<2 x i64> %i) nounwind {
28 %A = mul <2 x i64> %i, < i64 117, i64 117 >
32 define <4 x i32> @c(<4 x i32> %i, <4 x i32> %j) nounwind {
34 ; SSE2: pshufd {{.*}} # [[X2:xmm[0-9]+]] = xmm0[1,0,3,0]
35 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
36 ; SSE2-NEXT: pshufd {{.*}} # xmm1 = xmm1[1,0,3,0]
37 ; SSE2-NEXT: pmuludq %[[X2]], %xmm1
38 ; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[0,2]
39 ; SSE2-NEXT: pshufd {{.*}} # xmm0 = xmm0[0,2,1,3]
46 %A = mul <4 x i32> %i, %j
50 define <2 x i64> @d(<2 x i64> %i, <2 x i64> %j) nounwind {
56 %A = mul <2 x i64> %i, %j
62 define <4 x i32> @e(<4 x i32> %i, <4 x i32> %j) nounwind {
64 ; SSE2: movdqa {{[0-9]*}}(%rsp), %[[X1:xmm[0-9]+]]
65 ; SSE2-NEXT: pshufd {{.*}} # xmm0 = [[X2]][1,0,3,0]
66 ; SSE2-NEXT: movdqa {{[0-9]*}}(%rsp), %[[X2:xmm[0-9]+]]
67 ; SSE2-NEXT: pmuludq %[[X2]], %[[X1]]
68 ; SSE2-NEXT: pshufd {{.*}} # [[X2]] = [[X2]][1,0,3,0]
69 ; SSE2-NEXT: pmuludq %xmm0, %[[X2]]
70 ; SSE2-NEXT: shufps {{.*}} # [[X1]] = [[X1]][0,2],[[X2]][0,2]
71 ; SSE2-NEXT: pshufd {{.*}} # xmm0 = [[X1]][0,2,1,3]
72 ; SSE2-NEXT: addq ${{[0-9]+}}, %rsp
76 ; SSE41: pmulld {{[0-9]+}}(%rsp), %xmm
77 ; SSE41-NEXT: addq ${{[0-9]+}}, %rsp
80 ; Use a call to force spills.
82 %A = mul <4 x i32> %i, %j
86 define <2 x i64> @f(<2 x i64> %i, <2 x i64> %j) nounwind {
92 ; Use a call to force spills.
94 %A = mul <2 x i64> %i, %j