1 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=zEC12 | FileCheck %s
3 ; Check the cost values for older subtargets that use an IPM sequence for
4 ; extension of a compare result.
6 define i8 @fun0(i8 %val1, i8 %val2) {
7 %cmp = icmp eq i8 %val1, %val2
8 %v = sext i1 %cmp to i8
12 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
13 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i8
16 define i16 @fun1(i8 %val1, i8 %val2) {
17 %cmp = icmp eq i8 %val1, %val2
18 %v = sext i1 %cmp to i16
22 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
23 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i16
26 define i32 @fun2(i8 %val1, i8 %val2) {
27 %cmp = icmp eq i8 %val1, %val2
28 %v = sext i1 %cmp to i32
32 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
33 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i32
36 define i64 @fun3(i8 %val1, i8 %val2) {
37 %cmp = icmp eq i8 %val1, %val2
38 %v = sext i1 %cmp to i64
42 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
43 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i64
46 define i8 @fun4(i16 %val1, i16 %val2) {
47 %cmp = icmp eq i16 %val1, %val2
48 %v = sext i1 %cmp to i8
52 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
53 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i8
56 define i16 @fun5(i16 %val1, i16 %val2) {
57 %cmp = icmp eq i16 %val1, %val2
58 %v = sext i1 %cmp to i16
62 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
63 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i16
66 define i32 @fun6(i16 %val1, i16 %val2) {
67 %cmp = icmp eq i16 %val1, %val2
68 %v = sext i1 %cmp to i32
72 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
73 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i32
76 define i64 @fun7(i16 %val1, i16 %val2) {
77 %cmp = icmp eq i16 %val1, %val2
78 %v = sext i1 %cmp to i64
82 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
83 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i64
86 define i8 @fun8(i32 %val1, i32 %val2) {
87 %cmp = icmp eq i32 %val1, %val2
88 %v = sext i1 %cmp to i8
92 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
93 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i8
96 define i16 @fun9(i32 %val1, i32 %val2) {
97 %cmp = icmp eq i32 %val1, %val2
98 %v = sext i1 %cmp to i16
102 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
103 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i16
106 define i32 @fun10(i32 %val1, i32 %val2) {
107 %cmp = icmp eq i32 %val1, %val2
108 %v = sext i1 %cmp to i32
112 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
113 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i32
116 define i64 @fun11(i32 %val1, i32 %val2) {
117 %cmp = icmp eq i32 %val1, %val2
118 %v = sext i1 %cmp to i64
122 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
123 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i64
126 define i8 @fun12(i64 %val1, i64 %val2) {
127 %cmp = icmp eq i64 %val1, %val2
128 %v = sext i1 %cmp to i8
132 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
133 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i8
136 define i16 @fun13(i64 %val1, i64 %val2) {
137 %cmp = icmp eq i64 %val1, %val2
138 %v = sext i1 %cmp to i16
142 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
143 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i16
146 define i32 @fun14(i64 %val1, i64 %val2) {
147 %cmp = icmp eq i64 %val1, %val2
148 %v = sext i1 %cmp to i32
152 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
153 ; CHECK: cost of 3 for instruction: %v = sext i1 %cmp to i32
156 define i64 @fun15(i64 %val1, i64 %val2) {
157 %cmp = icmp eq i64 %val1, %val2
158 %v = sext i1 %cmp to i64
162 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
163 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i64
166 define i8 @fun16(float %val1, float %val2) {
167 %cmp = fcmp ogt float %val1, %val2
168 %v = sext i1 %cmp to i8
172 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
173 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i8
176 define i16 @fun17(float %val1, float %val2) {
177 %cmp = fcmp ogt float %val1, %val2
178 %v = sext i1 %cmp to i16
182 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
183 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i16
186 define i32 @fun18(float %val1, float %val2) {
187 %cmp = fcmp ogt float %val1, %val2
188 %v = sext i1 %cmp to i32
192 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
193 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i32
196 define i64 @fun19(float %val1, float %val2) {
197 %cmp = fcmp ogt float %val1, %val2
198 %v = sext i1 %cmp to i64
202 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
203 ; CHECK: cost of 5 for instruction: %v = sext i1 %cmp to i64
206 define i8 @fun20(double %val1, double %val2) {
207 %cmp = fcmp ogt double %val1, %val2
208 %v = sext i1 %cmp to i8
212 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
213 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i8
216 define i16 @fun21(double %val1, double %val2) {
217 %cmp = fcmp ogt double %val1, %val2
218 %v = sext i1 %cmp to i16
222 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
223 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i16
226 define i32 @fun22(double %val1, double %val2) {
227 %cmp = fcmp ogt double %val1, %val2
228 %v = sext i1 %cmp to i32
232 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
233 ; CHECK: cost of 4 for instruction: %v = sext i1 %cmp to i32
236 define i64 @fun23(double %val1, double %val2) {
237 %cmp = fcmp ogt double %val1, %val2
238 %v = sext i1 %cmp to i64
242 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
243 ; CHECK: cost of 5 for instruction: %v = sext i1 %cmp to i64
246 define i8 @fun120(i8 %val1, i8 %val2) {
247 %cmp = icmp eq i8 %val1, %val2
248 %v = zext i1 %cmp to i8
252 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
253 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i8
256 define i16 @fun121(i8 %val1, i8 %val2) {
257 %cmp = icmp eq i8 %val1, %val2
258 %v = zext i1 %cmp to i16
262 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
263 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i16
266 define i32 @fun122(i8 %val1, i8 %val2) {
267 %cmp = icmp eq i8 %val1, %val2
268 %v = zext i1 %cmp to i32
272 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
273 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i32
276 define i64 @fun123(i8 %val1, i8 %val2) {
277 %cmp = icmp eq i8 %val1, %val2
278 %v = zext i1 %cmp to i64
282 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i8 %val1, %val2
283 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i64
286 define i8 @fun124(i16 %val1, i16 %val2) {
287 %cmp = icmp eq i16 %val1, %val2
288 %v = zext i1 %cmp to i8
292 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
293 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i8
296 define i16 @fun125(i16 %val1, i16 %val2) {
297 %cmp = icmp eq i16 %val1, %val2
298 %v = zext i1 %cmp to i16
302 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
303 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i16
306 define i32 @fun126(i16 %val1, i16 %val2) {
307 %cmp = icmp eq i16 %val1, %val2
308 %v = zext i1 %cmp to i32
312 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
313 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i32
316 define i64 @fun127(i16 %val1, i16 %val2) {
317 %cmp = icmp eq i16 %val1, %val2
318 %v = zext i1 %cmp to i64
322 ; CHECK: cost of 3 for instruction: %cmp = icmp eq i16 %val1, %val2
323 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i64
326 define i8 @fun128(i32 %val1, i32 %val2) {
327 %cmp = icmp eq i32 %val1, %val2
328 %v = zext i1 %cmp to i8
332 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
333 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i8
336 define i16 @fun129(i32 %val1, i32 %val2) {
337 %cmp = icmp eq i32 %val1, %val2
338 %v = zext i1 %cmp to i16
342 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
343 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i16
346 define i32 @fun130(i32 %val1, i32 %val2) {
347 %cmp = icmp eq i32 %val1, %val2
348 %v = zext i1 %cmp to i32
352 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
353 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i32
356 define i64 @fun131(i32 %val1, i32 %val2) {
357 %cmp = icmp eq i32 %val1, %val2
358 %v = zext i1 %cmp to i64
362 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i32 %val1, %val2
363 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i64
366 define i8 @fun132(i64 %val1, i64 %val2) {
367 %cmp = icmp eq i64 %val1, %val2
368 %v = zext i1 %cmp to i8
372 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
373 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i8
376 define i16 @fun133(i64 %val1, i64 %val2) {
377 %cmp = icmp eq i64 %val1, %val2
378 %v = zext i1 %cmp to i16
382 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
383 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i16
386 define i32 @fun134(i64 %val1, i64 %val2) {
387 %cmp = icmp eq i64 %val1, %val2
388 %v = zext i1 %cmp to i32
392 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
393 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i32
396 define i64 @fun135(i64 %val1, i64 %val2) {
397 %cmp = icmp eq i64 %val1, %val2
398 %v = zext i1 %cmp to i64
402 ; CHECK: cost of 1 for instruction: %cmp = icmp eq i64 %val1, %val2
403 ; CHECK: cost of 3 for instruction: %v = zext i1 %cmp to i64
406 define i8 @fun136(float %val1, float %val2) {
407 %cmp = fcmp ogt float %val1, %val2
408 %v = zext i1 %cmp to i8
412 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
413 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i8
416 define i16 @fun137(float %val1, float %val2) {
417 %cmp = fcmp ogt float %val1, %val2
418 %v = zext i1 %cmp to i16
422 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
423 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i16
426 define i32 @fun138(float %val1, float %val2) {
427 %cmp = fcmp ogt float %val1, %val2
428 %v = zext i1 %cmp to i32
432 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
433 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i32
436 define i64 @fun139(float %val1, float %val2) {
437 %cmp = fcmp ogt float %val1, %val2
438 %v = zext i1 %cmp to i64
442 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt float %val1, %val2
443 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i64
446 define i8 @fun140(double %val1, double %val2) {
447 %cmp = fcmp ogt double %val1, %val2
448 %v = zext i1 %cmp to i8
452 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
453 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i8
456 define i16 @fun141(double %val1, double %val2) {
457 %cmp = fcmp ogt double %val1, %val2
458 %v = zext i1 %cmp to i16
462 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
463 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i16
466 define i32 @fun142(double %val1, double %val2) {
467 %cmp = fcmp ogt double %val1, %val2
468 %v = zext i1 %cmp to i32
472 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
473 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i32
476 define i64 @fun143(double %val1, double %val2) {
477 %cmp = fcmp ogt double %val1, %val2
478 %v = zext i1 %cmp to i64
482 ; CHECK: cost of 1 for instruction: %cmp = fcmp ogt double %val1, %val2
483 ; CHECK: cost of 4 for instruction: %v = zext i1 %cmp to i64