1 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
3 ; Check costs of divisions by register
5 ; Note: Vectorization of division/remainder is temporarily disabled for high
6 ; vectorization factors by returning 1000.
10 define i64 @fun0(i64 %a, i64 %b) {
13 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i64
16 define i32 @fun1(i32 %a, i32 %b) {
19 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i32 %a, %b
22 define i16 @fun2(i16 %a, i16 %b) {
25 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i16 %a, %b
28 define i8 @fun3(i8 %a, i8 %b) {
31 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = sdiv i8 %a, %b
36 define <2 x i64> @fun4(<2 x i64> %a, <2 x i64> %b) {
37 %r = sdiv <2 x i64> %a, %b
39 ; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = sdiv <2 x i64>
42 define <4 x i32> @fun5(<4 x i32> %a, <4 x i32> %b) {
43 %r = sdiv <4 x i32> %a, %b
45 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = sdiv <4 x i32>
48 define <2 x i32> @fun6(<2 x i32> %a, <2 x i32> %b) {
49 %r = sdiv <2 x i32> %a, %b
51 ; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = sdiv <2 x i32>
54 define <8 x i16> @fun7(<8 x i16> %a, <8 x i16> %b) {
55 %r = sdiv <8 x i16> %a, %b
57 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <8 x i16>
60 define <4 x i16> @fun8(<4 x i16> %a, <4 x i16> %b) {
61 %r = sdiv <4 x i16> %a, %b
63 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = sdiv <4 x i16>
66 define <16 x i8> @fun9(<16 x i8> %a, <16 x i8> %b) {
67 %r = sdiv <16 x i8> %a, %b
69 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <16 x i8>
72 define <8 x i8> @fun10(<8 x i8> %a, <8 x i8> %b) {
73 %r = sdiv <8 x i8> %a, %b
75 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = sdiv <8 x i8>
80 define i64 @fun11(i64 %a, i64 %b) {
83 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i64 %a, %b
86 define i32 @fun12(i32 %a, i32 %b) {
89 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i32
92 define i16 @fun13(i16 %a, i16 %b) {
95 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i16
98 define i8 @fun14(i8 %a, i8 %b) {
101 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = udiv i8
106 define <2 x i64> @fun15(<2 x i64> %a, <2 x i64> %b) {
107 %r = udiv <2 x i64> %a, %b
109 ; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = udiv <2 x i64>
112 define <4 x i32> @fun16(<4 x i32> %a, <4 x i32> %b) {
113 %r = udiv <4 x i32> %a, %b
115 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = udiv <4 x i32>
118 define <2 x i32> @fun17(<2 x i32> %a, <2 x i32> %b) {
119 %r = udiv <2 x i32> %a, %b
121 ; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = udiv <2 x i32>
124 define <8 x i16> @fun18(<8 x i16> %a, <8 x i16> %b) {
125 %r = udiv <8 x i16> %a, %b
127 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <8 x i16>
130 define <4 x i16> @fun19(<4 x i16> %a, <4 x i16> %b) {
131 %r = udiv <4 x i16> %a, %b
133 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = udiv <4 x i16>
136 define <16 x i8> @fun20(<16 x i8> %a, <16 x i8> %b) {
137 %r = udiv <16 x i8> %a, %b
139 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <16 x i8>
142 define <8 x i8> @fun21(<8 x i8> %a, <8 x i8> %b) {
143 %r = udiv <8 x i8> %a, %b
145 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = udiv <8 x i8>
150 define i64 @fun22(i64 %a, i64 %b) {
153 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i64
156 define i32 @fun23(i32 %a, i32 %b) {
159 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i32
162 define i16 @fun24(i16 %a, i16 %b) {
165 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i16
168 define i8 @fun25(i8 %a, i8 %b) {
171 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = srem i8
176 define <2 x i64> @fun26(<2 x i64> %a, <2 x i64> %b) {
177 %r = srem <2 x i64> %a, %b
179 ; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = srem <2 x i64>
182 define <4 x i32> @fun27(<4 x i32> %a, <4 x i32> %b) {
183 %r = srem <4 x i32> %a, %b
185 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = srem <4 x i32>
188 define <2 x i32> @fun28(<2 x i32> %a, <2 x i32> %b) {
189 %r = srem <2 x i32> %a, %b
191 ; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = srem <2 x i32>
194 define <8 x i16> @fun29(<8 x i16> %a, <8 x i16> %b) {
195 %r = srem <8 x i16> %a, %b
197 ; CHECK: ost Model: Found an estimated cost of 1000 for instruction: %r = srem <8 x i16>
200 define <4 x i16> @fun30(<4 x i16> %a, <4 x i16> %b) {
201 %r = srem <4 x i16> %a, %b
203 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = srem <4 x i16>
206 define <16 x i8> @fun31(<16 x i8> %a, <16 x i8> %b) {
207 %r = srem <16 x i8> %a, %b
209 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = srem <16 x i8>
212 define <8 x i8> @fun32(<8 x i8> %a, <8 x i8> %b) {
213 %r = srem <8 x i8> %a, %b
215 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = srem <8 x i8>
220 define i64 @fun33(i64 %a, i64 %b) {
223 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i64
226 define i32 @fun34(i32 %a, i32 %b) {
229 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i32
232 define i16 @fun35(i16 %a, i16 %b) {
235 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i16
238 define i8 @fun36(i8 %a, i8 %b) {
241 ; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %r = urem i8
246 define <2 x i64> @fun37(<2 x i64> %a, <2 x i64> %b) {
247 %r = urem <2 x i64> %a, %b
249 ; CHECK: Cost Model: Found an estimated cost of 47 for instruction: %r = urem <2 x i64>
252 define <4 x i32> @fun38(<4 x i32> %a, <4 x i32> %b) {
253 %r = urem <4 x i32> %a, %b
255 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = urem <4 x i32>
258 define <2 x i32> @fun39(<2 x i32> %a, <2 x i32> %b) {
259 %r = urem <2 x i32> %a, %b
261 ; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %r = urem <2 x i32>
264 define <8 x i16> @fun40(<8 x i16> %a, <8 x i16> %b) {
265 %r = urem <8 x i16> %a, %b
267 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <8 x i16>
270 define <4 x i16> @fun41(<4 x i16> %a, <4 x i16> %b) {
271 %r = urem <4 x i16> %a, %b
273 ; CHECK: Cost Model: Found an estimated cost of 94 for instruction: %r = urem <4 x i16>
276 define <16 x i8> @fun42(<16 x i8> %a, <16 x i8> %b) {
277 %r = urem <16 x i8> %a, %b
279 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <16 x i8>
282 define <8 x i8> @fun43(<8 x i8> %a, <8 x i8> %b) {
283 %r = urem <8 x i8> %a, %b
285 ; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %r = urem <8 x i8>