xref: /aosp_15_r20/external/llvm/test/Analysis/CostModel/X86/vshift-shl-cost.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2,-sse4.1 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE2
2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE41
3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7-avx -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX
4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core-avx2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX2
5*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX
6*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver4 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=XOP -check-prefix=XOPAVX2
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Verify the cost of vector shift left instructions.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker;
11*9880d681SAndroid Build Coastguard Worker;
12*9880d681SAndroid Build Coastguard Worker; Variable Shifts
13*9880d681SAndroid Build Coastguard Worker;
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @var_shift_v2i64(<2 x i64> %a, <2 x i64> %b) {
16*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v2i64':
17*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 4 for instruction:   %shift
18*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shift
19*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shift
20*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
21*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
22*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
23*9880d681SAndroid Build Coastguard Worker  %shift = shl <2 x i64> %a, %b
24*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %shift
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @var_shift_v4i64(<4 x i64> %a, <4 x i64> %b) {
28*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v4i64':
29*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 8 for instruction:   %shift
30*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 8 for instruction:   %shift
31*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shift
32*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
33*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
34*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
35*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i64> %a, %b
36*9880d681SAndroid Build Coastguard Worker  ret <4 x i64> %shift
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @var_shift_v4i32(<4 x i32> %a, <4 x i32> %b) {
40*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v4i32':
41*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 10 for instruction:   %shift
42*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 10 for instruction:   %shift
43*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 10 for instruction:   %shift
44*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
45*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
46*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
47*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i32> %a, %b
48*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shift
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @var_shift_v8i32(<8 x i32> %a, <8 x i32> %b) {
52*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v8i32':
53*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 20 for instruction:   %shift
54*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 20 for instruction:   %shift
55*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 20 for instruction:   %shift
56*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
57*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
58*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
59*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i32> %a, %b
60*9880d681SAndroid Build Coastguard Worker  ret <8 x i32> %shift
61*9880d681SAndroid Build Coastguard Worker}
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @var_shift_v8i16(<8 x i16> %a, <8 x i16> %b) {
64*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v8i16':
65*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 32 for instruction:   %shift
66*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 32 for instruction:   %shift
67*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 32 for instruction:   %shift
68*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 32 for instruction:   %shift
69*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
70*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i16> %a, %b
71*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shift
72*9880d681SAndroid Build Coastguard Worker}
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @var_shift_v16i16(<16 x i16> %a, <16 x i16> %b) {
75*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v16i16':
76*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 64 for instruction:   %shift
77*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 64 for instruction:   %shift
78*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 64 for instruction:   %shift
79*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 10 for instruction:   %shift
80*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
81*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i16> %a, %b
82*9880d681SAndroid Build Coastguard Worker  ret <16 x i16> %shift
83*9880d681SAndroid Build Coastguard Worker}
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @var_shift_v16i8(<16 x i8> %a, <16 x i8> %b) {
86*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v16i8':
87*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 26 for instruction:   %shift
88*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 26 for instruction:   %shift
89*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 26 for instruction:   %shift
90*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 26 for instruction:   %shift
91*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
92*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i8> %a, %b
93*9880d681SAndroid Build Coastguard Worker  ret <16 x i8> %shift
94*9880d681SAndroid Build Coastguard Worker}
95*9880d681SAndroid Build Coastguard Worker
96*9880d681SAndroid Build Coastguard Workerdefine <32 x i8> @var_shift_v32i8(<32 x i8> %a, <32 x i8> %b) {
97*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'var_shift_v32i8':
98*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 52 for instruction:   %shift
99*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 52 for instruction:   %shift
100*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 52 for instruction:   %shift
101*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 11 for instruction:   %shift
102*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
103*9880d681SAndroid Build Coastguard Worker  %shift = shl <32 x i8> %a, %b
104*9880d681SAndroid Build Coastguard Worker  ret <32 x i8> %shift
105*9880d681SAndroid Build Coastguard Worker}
106*9880d681SAndroid Build Coastguard Worker
107*9880d681SAndroid Build Coastguard Worker;
108*9880d681SAndroid Build Coastguard Worker; Uniform Variable Shifts
109*9880d681SAndroid Build Coastguard Worker;
110*9880d681SAndroid Build Coastguard Worker
111*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @splatvar_shift_v2i64(<2 x i64> %a, <2 x i64> %b) {
112*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v2i64':
113*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 4 for instruction:   %shift
114*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shift
115*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shift
116*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
117*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
118*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
119*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <2 x i64> %b, <2 x i64> undef, <2 x i32> zeroinitializer
120*9880d681SAndroid Build Coastguard Worker  %shift = shl <2 x i64> %a, %splat
121*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %shift
122*9880d681SAndroid Build Coastguard Worker}
123*9880d681SAndroid Build Coastguard Worker
124*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @splatvar_shift_v4i64(<4 x i64> %a, <4 x i64> %b) {
125*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v4i64':
126*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 8 for instruction:   %shift
127*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 8 for instruction:   %shift
128*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shift
129*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
130*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
131*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
132*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> zeroinitializer
133*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i64> %a, %splat
134*9880d681SAndroid Build Coastguard Worker  ret <4 x i64> %shift
135*9880d681SAndroid Build Coastguard Worker}
136*9880d681SAndroid Build Coastguard Worker
137*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @splatvar_shift_v4i32(<4 x i32> %a, <4 x i32> %b) {
138*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v4i32':
139*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 10 for instruction:   %shift
140*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 10 for instruction:   %shift
141*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 10 for instruction:   %shift
142*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
143*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
144*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
145*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <4 x i32> %b, <4 x i32> undef, <4 x i32> zeroinitializer
146*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i32> %a, %splat
147*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shift
148*9880d681SAndroid Build Coastguard Worker}
149*9880d681SAndroid Build Coastguard Worker
150*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @splatvar_shift_v8i32(<8 x i32> %a, <8 x i32> %b) {
151*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v8i32':
152*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 20 for instruction:   %shift
153*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 20 for instruction:   %shift
154*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 20 for instruction:   %shift
155*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
156*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
157*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
158*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <8 x i32> %b, <8 x i32> undef, <8 x i32> zeroinitializer
159*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i32> %a, %splat
160*9880d681SAndroid Build Coastguard Worker  ret <8 x i32> %shift
161*9880d681SAndroid Build Coastguard Worker}
162*9880d681SAndroid Build Coastguard Worker
163*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @splatvar_shift_v8i16(<8 x i16> %a, <8 x i16> %b) {
164*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v8i16':
165*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 32 for instruction:   %shift
166*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 32 for instruction:   %shift
167*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 32 for instruction:   %shift
168*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 32 for instruction:   %shift
169*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
170*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <8 x i16> %b, <8 x i16> undef, <8 x i32> zeroinitializer
171*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i16> %a, %splat
172*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shift
173*9880d681SAndroid Build Coastguard Worker}
174*9880d681SAndroid Build Coastguard Worker
175*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @splatvar_shift_v16i16(<16 x i16> %a, <16 x i16> %b) {
176*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v16i16':
177*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 64 for instruction:   %shift
178*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 64 for instruction:   %shift
179*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 64 for instruction:   %shift
180*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 10 for instruction:   %shift
181*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
182*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <16 x i16> %b, <16 x i16> undef, <16 x i32> zeroinitializer
183*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i16> %a, %splat
184*9880d681SAndroid Build Coastguard Worker  ret <16 x i16> %shift
185*9880d681SAndroid Build Coastguard Worker}
186*9880d681SAndroid Build Coastguard Worker
187*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @splatvar_shift_v16i8(<16 x i8> %a, <16 x i8> %b) {
188*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v16i8':
189*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 26 for instruction:   %shift
190*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 26 for instruction:   %shift
191*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 26 for instruction:   %shift
192*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 26 for instruction:   %shift
193*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
194*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <16 x i8> %b, <16 x i8> undef, <16 x i32> zeroinitializer
195*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i8> %a, %splat
196*9880d681SAndroid Build Coastguard Worker  ret <16 x i8> %shift
197*9880d681SAndroid Build Coastguard Worker}
198*9880d681SAndroid Build Coastguard Worker
199*9880d681SAndroid Build Coastguard Workerdefine <32 x i8> @splatvar_shift_v32i8(<32 x i8> %a, <32 x i8> %b) {
200*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatvar_shift_v32i8':
201*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 52 for instruction:   %shift
202*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 52 for instruction:   %shift
203*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 52 for instruction:   %shift
204*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 11 for instruction:   %shift
205*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
206*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <32 x i8> %b, <32 x i8> undef, <32 x i32> zeroinitializer
207*9880d681SAndroid Build Coastguard Worker  %shift = shl <32 x i8> %a, %splat
208*9880d681SAndroid Build Coastguard Worker  ret <32 x i8> %shift
209*9880d681SAndroid Build Coastguard Worker}
210*9880d681SAndroid Build Coastguard Worker
211*9880d681SAndroid Build Coastguard Worker;
212*9880d681SAndroid Build Coastguard Worker; Constant Shifts
213*9880d681SAndroid Build Coastguard Worker;
214*9880d681SAndroid Build Coastguard Worker
215*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @constant_shift_v2i64(<2 x i64> %a) {
216*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v2i64':
217*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 4 for instruction:   %shift
218*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shift
219*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shift
220*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
221*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
222*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
223*9880d681SAndroid Build Coastguard Worker  %shift = shl <2 x i64> %a, <i64 1, i64 7>
224*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %shift
225*9880d681SAndroid Build Coastguard Worker}
226*9880d681SAndroid Build Coastguard Worker
227*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @constant_shift_v4i64(<4 x i64> %a) {
228*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v4i64':
229*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 8 for instruction:   %shift
230*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 8 for instruction:   %shift
231*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shift
232*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
233*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
234*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
235*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i64> %a, <i64 1, i64 7, i64 15, i64 31>
236*9880d681SAndroid Build Coastguard Worker  ret <4 x i64> %shift
237*9880d681SAndroid Build Coastguard Worker}
238*9880d681SAndroid Build Coastguard Worker
239*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @constant_shift_v4i32(<4 x i32> %a) {
240*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v4i32':
241*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 6 for instruction:   %shift
242*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
243*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
244*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
245*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
246*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
247*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i32> %a, <i32 4, i32 5, i32 6, i32 7>
248*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shift
249*9880d681SAndroid Build Coastguard Worker}
250*9880d681SAndroid Build Coastguard Worker
251*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @constant_shift_v8i32(<8 x i32> %a) {
252*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v8i32':
253*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 12 for instruction:   %shift
254*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
255*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shift
256*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
257*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
258*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
259*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i32> %a, <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>
260*9880d681SAndroid Build Coastguard Worker  ret <8 x i32> %shift
261*9880d681SAndroid Build Coastguard Worker}
262*9880d681SAndroid Build Coastguard Worker
263*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @constant_shift_v8i16(<8 x i16> %a) {
264*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v8i16':
265*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 1 for instruction:   %shift
266*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
267*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
268*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
269*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
270*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i16> %a, <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>
271*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shift
272*9880d681SAndroid Build Coastguard Worker}
273*9880d681SAndroid Build Coastguard Worker
274*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @constant_shift_v16i16(<16 x i16> %a) {
275*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v16i16':
276*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shift
277*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
278*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shift
279*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
280*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
281*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
282*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i16> %a, <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>
283*9880d681SAndroid Build Coastguard Worker  ret <16 x i16> %shift
284*9880d681SAndroid Build Coastguard Worker}
285*9880d681SAndroid Build Coastguard Worker
286*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @constant_shift_v16i8(<16 x i8> %a) {
287*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v16i8':
288*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 26 for instruction:   %shift
289*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 26 for instruction:   %shift
290*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 26 for instruction:   %shift
291*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 26 for instruction:   %shift
292*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
293*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>
294*9880d681SAndroid Build Coastguard Worker  ret <16 x i8> %shift
295*9880d681SAndroid Build Coastguard Worker}
296*9880d681SAndroid Build Coastguard Worker
297*9880d681SAndroid Build Coastguard Workerdefine <32 x i8> @constant_shift_v32i8(<32 x i8> %a) {
298*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'constant_shift_v32i8':
299*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 52 for instruction:   %shift
300*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 52 for instruction:   %shift
301*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 52 for instruction:   %shift
302*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 11 for instruction:   %shift
303*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
304*9880d681SAndroid Build Coastguard Worker  %shift = shl <32 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>
305*9880d681SAndroid Build Coastguard Worker  ret <32 x i8> %shift
306*9880d681SAndroid Build Coastguard Worker}
307*9880d681SAndroid Build Coastguard Worker
308*9880d681SAndroid Build Coastguard Worker;
309*9880d681SAndroid Build Coastguard Worker; Uniform Constant Shifts
310*9880d681SAndroid Build Coastguard Worker;
311*9880d681SAndroid Build Coastguard Worker
312*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @splatconstant_shift_v2i64(<2 x i64> %a) {
313*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v2i64':
314*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 1 for instruction:   %shift
315*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
316*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
317*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
318*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
319*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
320*9880d681SAndroid Build Coastguard Worker  %shift = shl <2 x i64> %a, <i64 7, i64 7>
321*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %shift
322*9880d681SAndroid Build Coastguard Worker}
323*9880d681SAndroid Build Coastguard Worker
324*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @splatconstant_shift_v4i64(<4 x i64> %a) {
325*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v4i64':
326*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shift
327*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
328*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 2 for instruction:   %shift
329*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
330*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
331*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
332*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i64> %a, <i64 7, i64 7, i64 7, i64 7>
333*9880d681SAndroid Build Coastguard Worker  ret <4 x i64> %shift
334*9880d681SAndroid Build Coastguard Worker}
335*9880d681SAndroid Build Coastguard Worker
336*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @splatconstant_shift_v4i32(<4 x i32> %a) {
337*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v4i32':
338*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 1 for instruction:   %shift
339*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
340*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
341*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
342*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 1 for instruction:   %shift
343*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
344*9880d681SAndroid Build Coastguard Worker  %shift = shl <4 x i32> %a, <i32 5, i32 5, i32 5, i32 5>
345*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shift
346*9880d681SAndroid Build Coastguard Worker}
347*9880d681SAndroid Build Coastguard Worker
348*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @splatconstant_shift_v8i32(<8 x i32> %a) {
349*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v8i32':
350*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shift
351*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
352*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 2 for instruction:   %shift
353*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
354*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
355*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
356*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i32> %a, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
357*9880d681SAndroid Build Coastguard Worker  ret <8 x i32> %shift
358*9880d681SAndroid Build Coastguard Worker}
359*9880d681SAndroid Build Coastguard Worker
360*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @splatconstant_shift_v8i16(<8 x i16> %a) {
361*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v8i16':
362*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 1 for instruction:   %shift
363*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
364*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
365*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
366*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
367*9880d681SAndroid Build Coastguard Worker  %shift = shl <8 x i16> %a, <i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3>
368*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shift
369*9880d681SAndroid Build Coastguard Worker}
370*9880d681SAndroid Build Coastguard Worker
371*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @splatconstant_shift_v16i16(<16 x i16> %a) {
372*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v16i16':
373*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shift
374*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
375*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 2 for instruction:   %shift
376*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
377*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shift
378*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shift
379*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i16> %a, <i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3, i16 3>
380*9880d681SAndroid Build Coastguard Worker  ret <16 x i16> %shift
381*9880d681SAndroid Build Coastguard Worker}
382*9880d681SAndroid Build Coastguard Worker
383*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @splatconstant_shift_v16i8(<16 x i8> %a) {
384*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v16i8':
385*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 1 for instruction:   %shift
386*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shift
387*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shift
388*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shift
389*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shift
390*9880d681SAndroid Build Coastguard Worker  %shift = shl <16 x i8> %a, <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>
391*9880d681SAndroid Build Coastguard Worker  ret <16 x i8> %shift
392*9880d681SAndroid Build Coastguard Worker}
393*9880d681SAndroid Build Coastguard Worker
394*9880d681SAndroid Build Coastguard Workerdefine <32 x i8> @splatconstant_shift_v32i8(<32 x i8> %a) {
395*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'splatconstant_shift_v32i8':
396*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shift
397*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shift
398*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 2 for instruction:   %shift
399*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 11 for instruction:   %shift
400*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 2 for instruction:   %shift
401*9880d681SAndroid Build Coastguard Worker  %shift = shl <32 x i8> %a, <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>
402*9880d681SAndroid Build Coastguard Worker  ret <32 x i8> %shift
403*9880d681SAndroid Build Coastguard Worker}
404*9880d681SAndroid Build Coastguard Worker
405*9880d681SAndroid Build Coastguard Worker;
406*9880d681SAndroid Build Coastguard Worker; Special Cases
407*9880d681SAndroid Build Coastguard Worker;
408*9880d681SAndroid Build Coastguard Worker
409*9880d681SAndroid Build Coastguard Worker; We always emit a single pmullw in the case of v8i16 vector shifts by
410*9880d681SAndroid Build Coastguard Worker; non-uniform constant.
411*9880d681SAndroid Build Coastguard Worker
412*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @test1(<8 x i16> %a) {
413*9880d681SAndroid Build Coastguard Worker  %shl = shl <8 x i16> %a, <i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11>
414*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shl
415*9880d681SAndroid Build Coastguard Worker}
416*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test1':
417*9880d681SAndroid Build Coastguard Worker; CHECK: Found an estimated cost of 1 for instruction:   %shl
418*9880d681SAndroid Build Coastguard Worker
419*9880d681SAndroid Build Coastguard Worker
420*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @test2(<8 x i16> %a) {
421*9880d681SAndroid Build Coastguard Worker  %shl = shl <8 x i16> %a, <i16 0, i16 undef, i16 0, i16 0, i16 1, i16 undef, i16 -1, i16 1>
422*9880d681SAndroid Build Coastguard Worker  ret <8 x i16> %shl
423*9880d681SAndroid Build Coastguard Worker}
424*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test2':
425*9880d681SAndroid Build Coastguard Worker; CHECK: Found an estimated cost of 1 for instruction:   %shl
426*9880d681SAndroid Build Coastguard Worker
427*9880d681SAndroid Build Coastguard Worker
428*9880d681SAndroid Build Coastguard Worker; With SSE4.1, v4i32 shifts can be lowered into a single pmulld instruction.
429*9880d681SAndroid Build Coastguard Worker; Make sure that the estimated cost is always 1 except for the case where
430*9880d681SAndroid Build Coastguard Worker; we only have SSE2 support. With SSE2, we are forced to special lower the
431*9880d681SAndroid Build Coastguard Worker; v4i32 mul as a 2x shuffle, 2x pmuludq, 2x shuffle.
432*9880d681SAndroid Build Coastguard Worker
433*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @test3(<4 x i32> %a) {
434*9880d681SAndroid Build Coastguard Worker  %shl = shl <4 x i32> %a, <i32 1, i32 -1, i32 2, i32 -3>
435*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shl
436*9880d681SAndroid Build Coastguard Worker}
437*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test3':
438*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 6 for instruction:   %shl
439*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shl
440*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shl
441*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
442*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shl
443*9880d681SAndroid Build Coastguard Worker
444*9880d681SAndroid Build Coastguard Worker
445*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @test4(<4 x i32> %a) {
446*9880d681SAndroid Build Coastguard Worker  %shl = shl <4 x i32> %a, <i32 0, i32 0, i32 1, i32 1>
447*9880d681SAndroid Build Coastguard Worker  ret <4 x i32> %shl
448*9880d681SAndroid Build Coastguard Worker}
449*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test4':
450*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 6 for instruction:   %shl
451*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 1 for instruction:   %shl
452*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 1 for instruction:   %shl
453*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
454*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shl
455*9880d681SAndroid Build Coastguard Worker
456*9880d681SAndroid Build Coastguard Worker
457*9880d681SAndroid Build Coastguard Worker; On AVX2 we are able to lower the following shift into a single
458*9880d681SAndroid Build Coastguard Worker; vpsllvq. Therefore, the expected cost is only 1.
459*9880d681SAndroid Build Coastguard Worker; In all other cases, this shift is scalarized as the target does not support
460*9880d681SAndroid Build Coastguard Worker; vpsllv instructions.
461*9880d681SAndroid Build Coastguard Worker
462*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @test5(<2 x i64> %a) {
463*9880d681SAndroid Build Coastguard Worker  %shl = shl <2 x i64> %a, <i64 2, i64 3>
464*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %shl
465*9880d681SAndroid Build Coastguard Worker}
466*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test5':
467*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 4 for instruction:   %shl
468*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shl
469*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shl
470*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
471*9880d681SAndroid Build Coastguard Worker; XOP: Found an estimated cost of 1 for instruction:   %shl
472*9880d681SAndroid Build Coastguard Worker
473*9880d681SAndroid Build Coastguard Worker
474*9880d681SAndroid Build Coastguard Worker; v16i16 and v8i32 shift left by non-uniform constant are lowered into
475*9880d681SAndroid Build Coastguard Worker; vector multiply instructions.  With AVX (but not AVX2), the vector multiply
476*9880d681SAndroid Build Coastguard Worker; is lowered into a sequence of: 1 extract + 2 vpmullw + 1 insert.
477*9880d681SAndroid Build Coastguard Worker;
478*9880d681SAndroid Build Coastguard Worker; With AVX2, instruction vpmullw works with 256bit quantities and
479*9880d681SAndroid Build Coastguard Worker; therefore there is no need to split the resulting vector multiply into
480*9880d681SAndroid Build Coastguard Worker; a sequence of two multiply.
481*9880d681SAndroid Build Coastguard Worker;
482*9880d681SAndroid Build Coastguard Worker; With SSE2 and SSE4.1, the vector shift cost for 'test6' is twice
483*9880d681SAndroid Build Coastguard Worker; the cost computed in the case of 'test1'. That is because the backend
484*9880d681SAndroid Build Coastguard Worker; simply emits 2 pmullw with no extract/insert.
485*9880d681SAndroid Build Coastguard Worker
486*9880d681SAndroid Build Coastguard Worker
487*9880d681SAndroid Build Coastguard Workerdefine <16 x i16> @test6(<16 x i16> %a) {
488*9880d681SAndroid Build Coastguard Worker  %shl = shl <16 x i16> %a, <i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11, i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11>
489*9880d681SAndroid Build Coastguard Worker  ret <16 x i16> %shl
490*9880d681SAndroid Build Coastguard Worker}
491*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test6':
492*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 2 for instruction:   %shl
493*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shl
494*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shl
495*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
496*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shl
497*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shl
498*9880d681SAndroid Build Coastguard Worker
499*9880d681SAndroid Build Coastguard Worker
500*9880d681SAndroid Build Coastguard Worker; With SSE2 and SSE4.1, the vector shift cost for 'test7' is twice
501*9880d681SAndroid Build Coastguard Worker; the cost computed in the case of 'test3'. That is because the multiply
502*9880d681SAndroid Build Coastguard Worker; is type-legalized into two 4i32 vector multiply.
503*9880d681SAndroid Build Coastguard Worker
504*9880d681SAndroid Build Coastguard Workerdefine <8 x i32> @test7(<8 x i32> %a) {
505*9880d681SAndroid Build Coastguard Worker  %shl = shl <8 x i32> %a, <i32 1, i32 1, i32 2, i32 3, i32 1, i32 1, i32 2, i32 3>
506*9880d681SAndroid Build Coastguard Worker  ret <8 x i32> %shl
507*9880d681SAndroid Build Coastguard Worker}
508*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test7':
509*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 12 for instruction:   %shl
510*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 2 for instruction:   %shl
511*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 4 for instruction:   %shl
512*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
513*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shl
514*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shl
515*9880d681SAndroid Build Coastguard Worker
516*9880d681SAndroid Build Coastguard Worker
517*9880d681SAndroid Build Coastguard Worker; On AVX2 we are able to lower the following shift into a single
518*9880d681SAndroid Build Coastguard Worker; vpsllvq. Therefore, the expected cost is only 1.
519*9880d681SAndroid Build Coastguard Worker; In all other cases, this shift is scalarized as the target does not support
520*9880d681SAndroid Build Coastguard Worker; vpsllv instructions.
521*9880d681SAndroid Build Coastguard Worker
522*9880d681SAndroid Build Coastguard Workerdefine <4 x i64> @test8(<4 x i64> %a) {
523*9880d681SAndroid Build Coastguard Worker  %shl = shl <4 x i64> %a, <i64 1, i64 2, i64 3, i64 4>
524*9880d681SAndroid Build Coastguard Worker  ret <4 x i64> %shl
525*9880d681SAndroid Build Coastguard Worker}
526*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test8':
527*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 8 for instruction:   %shl
528*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 8 for instruction:   %shl
529*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shl
530*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 1 for instruction:   %shl
531*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 2 for instruction:   %shl
532*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 1 for instruction:   %shl
533*9880d681SAndroid Build Coastguard Worker
534*9880d681SAndroid Build Coastguard Worker
535*9880d681SAndroid Build Coastguard Worker; Same as 'test6', with the difference that the cost is double.
536*9880d681SAndroid Build Coastguard Worker
537*9880d681SAndroid Build Coastguard Workerdefine <32 x i16> @test9(<32 x i16> %a) {
538*9880d681SAndroid Build Coastguard Worker  %shl = shl <32 x i16> %a, <i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11, i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11, i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11, i16 1, i16 1, i16 2, i16 3, i16 7, i16 0, i16 9, i16 11>
539*9880d681SAndroid Build Coastguard Worker  ret <32 x i16> %shl
540*9880d681SAndroid Build Coastguard Worker}
541*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test9':
542*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 4 for instruction:   %shl
543*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shl
544*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shl
545*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 2 for instruction:   %shl
546*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 4 for instruction:   %shl
547*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 2 for instruction:   %shl
548*9880d681SAndroid Build Coastguard Worker
549*9880d681SAndroid Build Coastguard Worker
550*9880d681SAndroid Build Coastguard Worker; Same as 'test7', except that now the cost is double.
551*9880d681SAndroid Build Coastguard Worker
552*9880d681SAndroid Build Coastguard Workerdefine <16 x i32> @test10(<16 x i32> %a) {
553*9880d681SAndroid Build Coastguard Worker  %shl = shl <16 x i32> %a, <i32 1, i32 1, i32 2, i32 3, i32 1, i32 1, i32 2, i32 3, i32 1, i32 1, i32 2, i32 3, i32 1, i32 1, i32 2, i32 3>
554*9880d681SAndroid Build Coastguard Worker  ret <16 x i32> %shl
555*9880d681SAndroid Build Coastguard Worker}
556*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test10':
557*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 24 for instruction:   %shl
558*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 4 for instruction:   %shl
559*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 8 for instruction:   %shl
560*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 2 for instruction:   %shl
561*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 4 for instruction:   %shl
562*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 2 for instruction:   %shl
563*9880d681SAndroid Build Coastguard Worker
564*9880d681SAndroid Build Coastguard Worker
565*9880d681SAndroid Build Coastguard Worker; On AVX2 we are able to lower the following shift into a sequence of
566*9880d681SAndroid Build Coastguard Worker; two vpsllvq instructions. Therefore, the expected cost is only 2.
567*9880d681SAndroid Build Coastguard Worker; In all other cases, this shift is scalarized as we don't have vpsllv
568*9880d681SAndroid Build Coastguard Worker; instructions.
569*9880d681SAndroid Build Coastguard Worker
570*9880d681SAndroid Build Coastguard Workerdefine <8 x i64> @test11(<8 x i64> %a) {
571*9880d681SAndroid Build Coastguard Worker  %shl = shl <8 x i64> %a, <i64 1, i64 1, i64 2, i64 3, i64 1, i64 1, i64 2, i64 3>
572*9880d681SAndroid Build Coastguard Worker  ret <8 x i64> %shl
573*9880d681SAndroid Build Coastguard Worker}
574*9880d681SAndroid Build Coastguard Worker; CHECK: 'Cost Model Analysis' for function 'test11':
575*9880d681SAndroid Build Coastguard Worker; SSE2: Found an estimated cost of 16 for instruction:   %shl
576*9880d681SAndroid Build Coastguard Worker; SSE41: Found an estimated cost of 16 for instruction:   %shl
577*9880d681SAndroid Build Coastguard Worker; AVX: Found an estimated cost of 16 for instruction:   %shl
578*9880d681SAndroid Build Coastguard Worker; AVX2: Found an estimated cost of 2 for instruction:   %shl
579*9880d681SAndroid Build Coastguard Worker; XOPAVX: Found an estimated cost of 4 for instruction:   %shl
580*9880d681SAndroid Build Coastguard Worker; XOPAVX2: Found an estimated cost of 2 for instruction:   %shl
581