1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -cost-model -analyze -mcpu=slm | FileCheck %s --check-prefixes=CHECK,SLM
3; RUN: opt < %s -cost-model -analyze -mcpu=goldmont | FileCheck %s --check-prefixes=CHECK,GLM
4; RUN: opt < %s -cost-model -analyze -mcpu=goldmont-plus | FileCheck %s --check-prefixes=CHECK,GLM
5
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7target triple = "x86_64-unknown-linux-gnu"
8
9define <2 x i64> @slm-costs_64_vector_add(<2 x i64> %a, <2 x i64> %b) {
10; SLM-LABEL: 'slm-costs_64_vector_add'
11; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = add <2 x i64> %a, %b
12; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
13;
14; GLM-LABEL: 'slm-costs_64_vector_add'
15; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = add <2 x i64> %a, %b
16; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
17;
18entry:
19  %res = add <2 x i64> %a, %b
20  ret <2 x i64> %res
21}
22
23define <2 x i64> @slm-costs_64_vector_sub(<2 x i64> %a, <2 x i64> %b) {
24; SLM-LABEL: 'slm-costs_64_vector_sub'
25; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = sub <2 x i64> %a, %b
26; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
27;
28; GLM-LABEL: 'slm-costs_64_vector_sub'
29; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = sub <2 x i64> %a, %b
30; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
31;
32entry:
33  %res = sub <2 x i64> %a, %b
34  ret <2 x i64> %res
35}
36
37; 8bit mul
38define i8 @slm-costs_8_scalar_mul(i8 %a, i8 %b)  {
39; CHECK-LABEL: 'slm-costs_8_scalar_mul'
40; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw i8 %a, %b
41; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %res
42;
43entry:
44  %res = mul nsw i8 %a, %b
45  ret i8 %res
46}
47
48define <2 x i8> @slm-costs_8_v2_mul(<2 x i8> %a, <2 x i8> %b)  {
49; SLM-LABEL: 'slm-costs_8_v2_mul'
50; SLM-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %res = mul nsw <2 x i8> %a, %b
51; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %res
52;
53; GLM-LABEL: 'slm-costs_8_v2_mul'
54; GLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = mul nsw <2 x i8> %a, %b
55; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %res
56;
57entry:
58  %res = mul nsw <2 x i8> %a, %b
59  ret <2 x i8> %res
60}
61
62define <4 x i8> @slm-costs_8_v4_mul(<4 x i8> %a, <4 x i8> %b)  {
63; SLM-LABEL: 'slm-costs_8_v4_mul'
64; SLM-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %res = mul nsw <4 x i8> %a, %b
65; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %res
66;
67; GLM-LABEL: 'slm-costs_8_v4_mul'
68; GLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = mul nsw <4 x i8> %a, %b
69; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %res
70;
71entry:
72  %res = mul nsw <4 x i8> %a, %b
73  ret <4 x i8> %res
74}
75
76define <4 x i32> @slm-costs_8_v4_zext_mul(<4 x i8> %a)  {
77; SLM-LABEL: 'slm-costs_8_v4_zext_mul'
78; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
79; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 255, i32 255>
80; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
81;
82; GLM-LABEL: 'slm-costs_8_v4_zext_mul'
83; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
84; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 255, i32 255>
85; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
86;
87entry:
88  %zext = zext <4 x i8> %a to <4 x i32>
89  %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 255, i32 255>
90  ret <4 x i32> %res
91}
92
93define <4 x i32> @slm-costs_8_v4_zext_mul_fail(<4 x i8> %a)  {
94; SLM-LABEL: 'slm-costs_8_v4_zext_mul_fail'
95; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
96; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 -1, i32 255>
97; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
98;
99; GLM-LABEL: 'slm-costs_8_v4_zext_mul_fail'
100; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
101; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 -1, i32 255>
102; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
103;
104entry:
105  %zext = zext <4 x i8> %a to <4 x i32>
106  %res = mul nsw <4 x i32> %zext, <i32 255, i32 255, i32 -1, i32 255>
107  ret <4 x i32> %res
108}
109
110define <4 x i32> @slm-costs_8_v4_zext_mul_fail_2(<4 x i8> %a)  {
111; SLM-LABEL: 'slm-costs_8_v4_zext_mul_fail_2'
112; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
113; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 256, i32 255, i32 255>
114; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
115;
116; GLM-LABEL: 'slm-costs_8_v4_zext_mul_fail_2'
117; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i8> %a to <4 x i32>
118; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %zext, <i32 255, i32 256, i32 255, i32 255>
119; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
120;
121entry:
122  %zext = zext <4 x i8> %a to <4 x i32>
123  %res = mul nsw <4 x i32> %zext, <i32 255, i32 256, i32 255, i32 255>
124  ret <4 x i32> %res
125}
126
127define <4 x i32> @slm-costs_8_v4_sext_mul(<4 x i8> %a)  {
128; SLM-LABEL: 'slm-costs_8_v4_sext_mul'
129; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
130; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 127, i32 -128>
131; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
132;
133; GLM-LABEL: 'slm-costs_8_v4_sext_mul'
134; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
135; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 127, i32 -128>
136; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
137;
138entry:
139  %sext = sext <4 x i8> %a to <4 x i32>
140  %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 127, i32 -128>
141  ret <4 x i32> %res
142}
143
144define <4 x i32> @slm-costs_8_v4_sext_mul_fail(<4 x i8> %a)  {
145; SLM-LABEL: 'slm-costs_8_v4_sext_mul_fail'
146; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
147; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 128, i32 -128>
148; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
149;
150; GLM-LABEL: 'slm-costs_8_v4_sext_mul_fail'
151; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
152; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 128, i32 -128>
153; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
154;
155entry:
156  %sext = sext <4 x i8> %a to <4 x i32>
157  %res = mul nsw <4 x i32> %sext, <i32 127, i32 -128, i32 128, i32 -128>
158  ret <4 x i32> %res
159}
160
161define <4 x i32> @slm-costs_8_v4_sext_mul_fail_2(<4 x i8> %a)  {
162; SLM-LABEL: 'slm-costs_8_v4_sext_mul_fail_2'
163; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
164; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -129, i32 127, i32 -128>
165; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
166;
167; GLM-LABEL: 'slm-costs_8_v4_sext_mul_fail_2'
168; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i8> %a to <4 x i32>
169; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %sext, <i32 127, i32 -129, i32 127, i32 -128>
170; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
171;
172entry:
173  %sext = sext <4 x i8> %a to <4 x i32>
174  %res = mul nsw <4 x i32> %sext, <i32 127, i32 -129, i32 127, i32 -128>
175  ret <4 x i32> %res
176}
177
178define <8 x i8> @slm-costs_8_v8_mul(<8 x i8> %a, <8 x i8> %b)  {
179; SLM-LABEL: 'slm-costs_8_v8_mul'
180; SLM-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %res = mul nsw <8 x i8> %a, %b
181; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %res
182;
183; GLM-LABEL: 'slm-costs_8_v8_mul'
184; GLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = mul nsw <8 x i8> %a, %b
185; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %res
186;
187entry:
188  %res = mul nsw <8 x i8> %a, %b
189  ret <8 x i8> %res
190}
191
192define <16 x i8> @slm-costs_8_v16_mul(<16 x i8> %a, <16 x i8> %b)  {
193; SLM-LABEL: 'slm-costs_8_v16_mul'
194; SLM-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %res = mul nsw <16 x i8> %a, %b
195; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %res
196;
197; GLM-LABEL: 'slm-costs_8_v16_mul'
198; GLM-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %res = mul nsw <16 x i8> %a, %b
199; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %res
200;
201entry:
202  %res = mul nsw <16 x i8> %a, %b
203  ret <16 x i8> %res
204}
205
206; 16bit mul
207define i16 @slm-costs_16_scalar_mul(i16 %a, i16 %b)  {
208; CHECK-LABEL: 'slm-costs_16_scalar_mul'
209; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw i16 %a, %b
210; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %res
211;
212entry:
213  %res = mul nsw i16 %a, %b
214  ret i16 %res
215}
216
217define <2 x i16> @slm-costs_16_v2_mul(<2 x i16> %a, <2 x i16> %b)  {
218; SLM-LABEL: 'slm-costs_16_v2_mul'
219; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <2 x i16> %a, %b
220; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %res
221;
222; GLM-LABEL: 'slm-costs_16_v2_mul'
223; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <2 x i16> %a, %b
224; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %res
225;
226entry:
227  %res = mul nsw <2 x i16> %a, %b
228  ret <2 x i16> %res
229}
230
231define <4 x i16> @slm-costs_16_v4_mul(<4 x i16> %a, <4 x i16> %b)  {
232; SLM-LABEL: 'slm-costs_16_v4_mul'
233; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i16> %a, %b
234; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %res
235;
236; GLM-LABEL: 'slm-costs_16_v4_mul'
237; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i16> %a, %b
238; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %res
239;
240entry:
241  %res = mul nsw <4 x i16> %a, %b
242  ret <4 x i16> %res
243}
244
245define <4 x i32> @slm-costs_16_v4_zext_mul(<4 x i16> %a)  {
246; SLM-LABEL: 'slm-costs_16_v4_zext_mul'
247; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
248; SLM-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %res = mul nsw <4 x i32> %zext, <i32 65535, i32 65535, i32 65535, i32 65535>
249; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
250;
251; GLM-LABEL: 'slm-costs_16_v4_zext_mul'
252; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
253; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 65535, i32 65535, i32 65535, i32 65535>
254; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
255;
256entry:
257  %zext = zext <4 x i16> %a to <4 x i32>
258  %res = mul nsw <4 x i32> %zext, <i32 65535, i32 65535, i32 65535, i32 65535>
259  ret <4 x i32> %res
260}
261
262define <4 x i32> @slm-costs_16_v4_zext_mul_fail(<4 x i16> %a)  {
263; SLM-LABEL: 'slm-costs_16_v4_zext_mul_fail'
264; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
265; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <4 x i32> %zext, <i32 -1, i32 65535, i32 65535, i32 65535>
266; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
267;
268; GLM-LABEL: 'slm-costs_16_v4_zext_mul_fail'
269; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
270; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 -1, i32 65535, i32 65535, i32 65535>
271; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
272;
273entry:
274  %zext = zext <4 x i16> %a to <4 x i32>
275  %res = mul nsw <4 x i32> %zext, <i32 -1, i32 65535, i32 65535, i32 65535>
276  ret <4 x i32> %res
277}
278
279define <4 x i32> @slm-costs_16_v4_zext_mul_fail_2(<4 x i16> %a)  {
280; SLM-LABEL: 'slm-costs_16_v4_zext_mul_fail_2'
281; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
282; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <4 x i32> %zext, <i32 65536, i32 65535, i32 65535, i32 65535>
283; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
284;
285; GLM-LABEL: 'slm-costs_16_v4_zext_mul_fail_2'
286; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %zext = zext <4 x i16> %a to <4 x i32>
287; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %zext, <i32 65536, i32 65535, i32 65535, i32 65535>
288; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
289;
290entry:
291  %zext = zext <4 x i16> %a to <4 x i32>
292  %res = mul nsw <4 x i32> %zext, <i32 65536, i32 65535, i32 65535, i32 65535>
293  ret <4 x i32> %res
294}
295
296define <4 x i32> @slm-costs_16_v4_sext_mul(<4 x i16> %a)  {
297; SLM-LABEL: 'slm-costs_16_v4_sext_mul'
298; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
299; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32768>
300; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
301;
302; GLM-LABEL: 'slm-costs_16_v4_sext_mul'
303; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
304; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32768>
305; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
306;
307entry:
308  %sext = sext <4 x i16> %a to <4 x i32>
309  %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32768>
310  ret <4 x i32> %res
311}
312
313define <4 x i32> @slm-costs_16_v4_sext_mul_fail(<4 x i16> %a)  {
314; SLM-LABEL: 'slm-costs_16_v4_sext_mul_fail'
315; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
316; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32768, i32 -32768>
317; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
318;
319; GLM-LABEL: 'slm-costs_16_v4_sext_mul_fail'
320; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
321; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32768, i32 -32768>
322; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
323;
324entry:
325  %sext = sext <4 x i16> %a to <4 x i32>
326  %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32768, i32 -32768>
327  ret <4 x i32> %res
328}
329
330define <4 x i32> @slm-costs_16_v4_sext_mul_fail_2(<4 x i16> %a)  {
331; SLM-LABEL: 'slm-costs_16_v4_sext_mul_fail_2'
332; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
333; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32769>
334; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
335;
336; GLM-LABEL: 'slm-costs_16_v4_sext_mul_fail_2'
337; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sext = sext <4 x i16> %a to <4 x i32>
338; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32769>
339; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
340;
341entry:
342  %sext = sext <4 x i16> %a to <4 x i32>
343  %res = mul nsw <4 x i32> %sext, <i32 32767, i32 -32768, i32 32767, i32 -32769>
344  ret <4 x i32> %res
345}
346
347define <8 x i16> @slm-costs_16_v8_mul(<8 x i16> %a, <8 x i16> %b)  {
348; SLM-LABEL: 'slm-costs_16_v8_mul'
349; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <8 x i16> %a, %b
350; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %res
351;
352; GLM-LABEL: 'slm-costs_16_v8_mul'
353; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw <8 x i16> %a, %b
354; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %res
355;
356entry:
357  %res = mul nsw <8 x i16> %a, %b
358  ret <8 x i16> %res
359}
360
361define <16 x i16> @slm-costs_16_v16_mul(<16 x i16> %a, <16 x i16> %b)  {
362; SLM-LABEL: 'slm-costs_16_v16_mul'
363; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = mul nsw <16 x i16> %a, %b
364; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %res
365;
366; GLM-LABEL: 'slm-costs_16_v16_mul'
367; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <16 x i16> %a, %b
368; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %res
369;
370entry:
371  %res = mul nsw <16 x i16> %a, %b
372  ret <16 x i16> %res
373}
374
375; 32bit mul
376define i32 @slm-costs_32_scalar_mul(i32 %a, i32 %b)  {
377; CHECK-LABEL: 'slm-costs_32_scalar_mul'
378; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = mul nsw i32 %a, %b
379; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %res
380;
381entry:
382  %res = mul nsw i32 %a, %b
383  ret i32 %res
384}
385
386define <2 x i32> @slm-costs_32_v2_mul(<2 x i32> %a, <2 x i32> %b)  {
387; SLM-LABEL: 'slm-costs_32_v2_mul'
388; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <2 x i32> %a, %b
389; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
390;
391; GLM-LABEL: 'slm-costs_32_v2_mul'
392; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <2 x i32> %a, %b
393; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
394;
395entry:
396  %res = mul nsw <2 x i32> %a, %b
397  ret <2 x i32> %res
398}
399
400define <4 x i32> @slm-costs_32_v4_mul(<4 x i32> %a, <4 x i32> %b)  {
401; SLM-LABEL: 'slm-costs_32_v4_mul'
402; SLM-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %res = mul nsw <4 x i32> %a, %b
403; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
404;
405; GLM-LABEL: 'slm-costs_32_v4_mul'
406; GLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw <4 x i32> %a, %b
407; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
408;
409entry:
410  %res = mul nsw <4 x i32> %a, %b
411  ret <4 x i32> %res
412}
413
414define <8 x i32> @slm-costs_32_v8_mul(<8 x i32> %a, <8 x i32> %b)  {
415; SLM-LABEL: 'slm-costs_32_v8_mul'
416; SLM-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %res = mul nsw <8 x i32> %a, %b
417; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
418;
419; GLM-LABEL: 'slm-costs_32_v8_mul'
420; GLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = mul nsw <8 x i32> %a, %b
421; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
422;
423entry:
424  %res = mul nsw <8 x i32> %a, %b
425  ret <8 x i32> %res
426}
427
428define <16 x i32> @slm-costs_32_v16_mul(<16 x i32> %a, <16 x i32> %b)  {
429; SLM-LABEL: 'slm-costs_32_v16_mul'
430; SLM-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %res = mul nsw <16 x i32> %a, %b
431; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %res
432;
433; GLM-LABEL: 'slm-costs_32_v16_mul'
434; GLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %res = mul nsw <16 x i32> %a, %b
435; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i32> %res
436;
437entry:
438  %res = mul nsw <16 x i32> %a, %b
439  ret <16 x i32> %res
440}
441
442; 64bit mul
443define i64 @slm-costs_64_scalar_mul(i64 %a, i64 %b)  {
444; CHECK-LABEL: 'slm-costs_64_scalar_mul'
445; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = mul nsw i64 %a, %b
446; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %res
447;
448entry:
449  %res = mul nsw i64 %a, %b
450  ret i64 %res
451}
452
453define <2 x i64> @slm-costs_64_v2_mul(<2 x i64> %a, <2 x i64> %b)  {
454; SLM-LABEL: 'slm-costs_64_v2_mul'
455; SLM-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %res = mul nsw <2 x i64> %a, %b
456; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
457;
458; GLM-LABEL: 'slm-costs_64_v2_mul'
459; GLM-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %res = mul nsw <2 x i64> %a, %b
460; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %res
461;
462entry:
463  %res = mul nsw <2 x i64> %a, %b
464  ret <2 x i64> %res
465}
466
467define <4 x i64> @slm-costs_64_v4_mul(<4 x i64> %a, <4 x i64> %b)  {
468; SLM-LABEL: 'slm-costs_64_v4_mul'
469; SLM-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %res = mul nsw <4 x i64> %a, %b
470; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
471;
472; GLM-LABEL: 'slm-costs_64_v4_mul'
473; GLM-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %res = mul nsw <4 x i64> %a, %b
474; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
475;
476entry:
477  %res = mul nsw <4 x i64> %a, %b
478  ret <4 x i64> %res
479}
480
481define <8 x i64> @slm-costs_64_v8_mul(<8 x i64> %a, <8 x i64> %b)  {
482; SLM-LABEL: 'slm-costs_64_v8_mul'
483; SLM-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %res = mul nsw <8 x i64> %a, %b
484; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
485;
486; GLM-LABEL: 'slm-costs_64_v8_mul'
487; GLM-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %res = mul nsw <8 x i64> %a, %b
488; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
489;
490entry:
491  %res = mul nsw <8 x i64> %a, %b
492  ret <8 x i64> %res
493}
494
495define <16 x i64> @slm-costs_64_v16_mul(<16 x i64> %a, <16 x i64> %b)  {
496; SLM-LABEL: 'slm-costs_64_v16_mul'
497; SLM-NEXT:  Cost Model: Found an estimated cost of 136 for instruction: %res = mul nsw <16 x i64> %a, %b
498; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
499;
500; GLM-LABEL: 'slm-costs_64_v16_mul'
501; GLM-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %res = mul nsw <16 x i64> %a, %b
502; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
503;
504entry:
505  %res = mul nsw <16 x i64> %a, %b
506  ret <16 x i64> %res
507}
508
509; mulsd
510define double @slm-costs_mulsd(double %a, double %b)  {
511; SLM-LABEL: 'slm-costs_mulsd'
512; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = fmul double %a, %b
513; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret double %res
514;
515; GLM-LABEL: 'slm-costs_mulsd'
516; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = fmul double %a, %b
517; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret double %res
518;
519entry:
520  %res = fmul double %a, %b
521  ret double %res
522}
523
524; mulpd
525define <2 x double> @slm-costs_mulpd(<2 x double> %a, <2 x double> %b)  {
526; SLM-LABEL: 'slm-costs_mulpd'
527; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %res = fmul <2 x double> %a, %b
528; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
529;
530; GLM-LABEL: 'slm-costs_mulpd'
531; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = fmul <2 x double> %a, %b
532; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
533;
534entry:
535  %res = fmul <2 x double> %a, %b
536  ret <2 x double> %res
537}
538
539; mulps
540define <4 x float> @slm-costs_mulps(<4 x float> %a, <4 x float> %b)  {
541; SLM-LABEL: 'slm-costs_mulps'
542; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = fmul <4 x float> %a, %b
543; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %res
544;
545; GLM-LABEL: 'slm-costs_mulps'
546; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = fmul <4 x float> %a, %b
547; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %res
548;
549entry:
550  %res = fmul <4 x float> %a, %b
551  ret <4 x float> %res
552}
553
554; divss
555define float @slm-costs_divss(float %a, float %b)  {
556; SLM-LABEL: 'slm-costs_divss'
557; SLM-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %res = fdiv float %a, %b
558; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret float %res
559;
560; GLM-LABEL: 'slm-costs_divss'
561; GLM-NEXT:  Cost Model: Found an estimated cost of 18 for instruction: %res = fdiv float %a, %b
562; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret float %res
563;
564entry:
565  %res = fdiv float %a, %b
566  ret float %res
567}
568
569; divps
570define <4 x float> @slm-costs_divps(<4 x float> %a, <4 x float> %b)  {
571; SLM-LABEL: 'slm-costs_divps'
572; SLM-NEXT:  Cost Model: Found an estimated cost of 39 for instruction: %res = fdiv <4 x float> %a, %b
573; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %res
574;
575; GLM-LABEL: 'slm-costs_divps'
576; GLM-NEXT:  Cost Model: Found an estimated cost of 35 for instruction: %res = fdiv <4 x float> %a, %b
577; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %res
578;
579entry:
580  %res = fdiv <4 x float> %a, %b
581  ret <4 x float> %res
582}
583
584; divsd
585define double @slm-costs_divsd(double %a, double %b)  {
586; SLM-LABEL: 'slm-costs_divsd'
587; SLM-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %res = fdiv double %a, %b
588; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret double %res
589;
590; GLM-LABEL: 'slm-costs_divsd'
591; GLM-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %res = fdiv double %a, %b
592; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret double %res
593;
594entry:
595  %res = fdiv double %a, %b
596  ret double %res
597}
598
599; divpd
600define <2 x double> @slm-costs_divpd(<2 x double> %a, <2 x double> %b)  {
601; SLM-LABEL: 'slm-costs_divpd'
602; SLM-NEXT:  Cost Model: Found an estimated cost of 69 for instruction: %res = fdiv <2 x double> %a, %b
603; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
604;
605; GLM-LABEL: 'slm-costs_divpd'
606; GLM-NEXT:  Cost Model: Found an estimated cost of 65 for instruction: %res = fdiv <2 x double> %a, %b
607; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
608;
609entry:
610  %res = fdiv <2 x double> %a, %b
611  ret <2 x double> %res
612}
613
614; addpd
615define <2 x double> @slm-costs_addpd(<2 x double> %a, <2 x double> %b)  {
616; SLM-LABEL: 'slm-costs_addpd'
617; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = fadd <2 x double> %a, %b
618; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
619;
620; GLM-LABEL: 'slm-costs_addpd'
621; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = fadd <2 x double> %a, %b
622; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
623;
624entry:
625  %res = fadd <2 x double> %a, %b
626  ret <2 x double> %res
627}
628
629; subpd
630define <2 x double> @slm-costs_subpd(<2 x double> %a, <2 x double> %b)  {
631; SLM-LABEL: 'slm-costs_subpd'
632; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %res = fsub <2 x double> %a, %b
633; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
634;
635; GLM-LABEL: 'slm-costs_subpd'
636; GLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %res = fsub <2 x double> %a, %b
637; GLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %res
638;
639entry:
640  %res = fsub <2 x double> %a, %b
641  ret <2 x double> %res
642}
643
644