1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 define <3 x i32> @f_29(<12 x i16> %a, <12 x i16> %b) {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
8 ; CHECK-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
9 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
10 ; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
11 ; CHECK-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
12 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
13 ; CHECK-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
14 ; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
15 ; CHECK-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
16 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
17 ; CHECK-NEXT: movd {{.*#+}} xmm3 = mem[0],zero,zero,zero
18 ; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
19 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
20 ; CHECK-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
21 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
22 ; CHECK-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
23 ; CHECK-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
24 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
25 ; CHECK-NEXT: movd %r9d, %xmm1
26 ; CHECK-NEXT: movd %r8d, %xmm3
27 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
28 ; CHECK-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
29 ; CHECK-NEXT: movd %ecx, %xmm1
30 ; CHECK-NEXT: movd %edx, %xmm2
31 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
32 ; CHECK-NEXT: movd %esi, %xmm4
33 ; CHECK-NEXT: movd %edi, %xmm1
34 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1],xmm1[2],xmm4[2],xmm1[3],xmm4[3]
35 ; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
36 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
37 ; CHECK-NEXT: movd {{.*#+}} xmm4 = mem[0],zero,zero,zero
38 ; CHECK-NEXT: pinsrw $1, {{[0-9]+}}(%rsp), %xmm4
39 ; CHECK-NEXT: pinsrw $2, {{[0-9]+}}(%rsp), %xmm4
40 ; CHECK-NEXT: pinsrw $3, {{[0-9]+}}(%rsp), %xmm4
41 ; CHECK-NEXT: movd {{.*#+}} xmm2 = mem[0],zero,zero,zero
42 ; CHECK-NEXT: pinsrw $1, {{[0-9]+}}(%rsp), %xmm2
43 ; CHECK-NEXT: pinsrw $2, {{[0-9]+}}(%rsp), %xmm2
44 ; CHECK-NEXT: pinsrw $3, {{[0-9]+}}(%rsp), %xmm2
45 ; CHECK-NEXT: movdqa %xmm1, %xmm3
46 ; CHECK-NEXT: pmulhuw %xmm0, %xmm3
47 ; CHECK-NEXT: pmullw %xmm0, %xmm1
48 ; CHECK-NEXT: movdqa %xmm1, %xmm0
49 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
50 ; CHECK-NEXT: pshufd {{.*#+}} xmm5 = xmm1[1,2,3,3]
51 ; CHECK-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7]
52 ; CHECK-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,4,6,6,7]
53 ; CHECK-NEXT: pshufd {{.*#+}} xmm6 = xmm3[2,3,2,3]
54 ; CHECK-NEXT: movdqa %xmm2, %xmm7
55 ; CHECK-NEXT: pmulhuw %xmm4, %xmm7
56 ; CHECK-NEXT: pshuflw {{.*#+}} xmm3 = xmm7[0,0,2,1,4,5,6,7]
57 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm3[0]
58 ; CHECK-NEXT: movdqa {{.*#+}} xmm3 = [65535,0,65535,0,65535,0,65535,0]
59 ; CHECK-NEXT: punpckhwd {{.*#+}} xmm5 = xmm5[4,4,5,5,6,6,7,7]
60 ; CHECK-NEXT: pmullw %xmm4, %xmm2
61 ; CHECK-NEXT: pshuflw {{.*#+}} xmm4 = xmm2[0,1,1,3,4,5,6,7]
62 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm5 = xmm5[0],xmm4[0]
63 ; CHECK-NEXT: pand %xmm3, %xmm5
64 ; CHECK-NEXT: pandn %xmm6, %xmm3
65 ; CHECK-NEXT: por %xmm5, %xmm3
66 ; CHECK-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm7[0],xmm2[1],xmm7[1],xmm2[2],xmm7[2],xmm2[3],xmm7[3]
67 ; CHECK-NEXT: movdqa %xmm3, %xmm4
68 ; CHECK-NEXT: shufps {{.*#+}} xmm4 = xmm4[1,1],xmm1[1,1]
69 ; CHECK-NEXT: movdqa %xmm0, %xmm5
70 ; CHECK-NEXT: shufps {{.*#+}} xmm5 = xmm5[1,3],xmm4[2,0]
71 ; CHECK-NEXT: pshufd {{.*#+}} xmm4 = xmm3[3,3,3,3]
72 ; CHECK-NEXT: pshufd {{.*#+}} xmm6 = xmm2[3,3,3,3]
73 ; CHECK-NEXT: punpckldq {{.*#+}} xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1]
74 ; CHECK-NEXT: movdqa %xmm3, %xmm6
75 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm6 = xmm6[0],xmm1[0]
76 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm6[2,0]
77 ; CHECK-NEXT: paddd %xmm5, %xmm0
78 ; CHECK-NEXT: punpckhdq {{.*#+}} xmm3 = xmm3[2],xmm2[2],xmm3[3],xmm2[3]
79 ; CHECK-NEXT: paddd %xmm4, %xmm3
80 ; CHECK-NEXT: movdqa %xmm0, %xmm1
81 ; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,3],xmm3[1,3]
82 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm3[0,3]
83 ; CHECK-NEXT: paddd %xmm1, %xmm0
86 %a32 = zext <12 x i16> %a to <12 x i32>
87 %b32 = zext <12 x i16> %b to <12 x i32>
88 %prod12 = mul nuw <12 x i32> %a32, %b32
89 %odd12 = shufflevector <12 x i32> %prod12, <12 x i32> undef, <6 x i32> <i32
90 1, i32 3, i32 5, i32 7, i32 9, i32 11>
91 %even12 = shufflevector <12 x i32> %prod12, <12 x i32> undef, <6 x i32> <i32
92 0, i32 2, i32 4, i32 6, i32 8, i32 10>
93 %prod6 = add <6 x i32> %odd12, %even12
94 %odd6 = shufflevector <6 x i32> %prod6, <6 x i32> undef, <3 x i32> <i32 1,
96 %even6 = shufflevector <6 x i32> %prod6, <6 x i32> undef, <3 x i32> <i32 0,
98 %result = add <3 x i32> %odd6, %even6