xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/int-operands-extcost.ll (revision 68c50b111d74afb9489cf97770fa917d0a1c7f77)
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 \
2; RUN:  | FileCheck %s
3;
4; Test that i8/i16 operands get extra costs for extensions to i32 only in
5; cases where this is needed.
6
7define void @icmp() {
8  %li8_0 = load i8, ptr undef
9  %li8_1 = load i8, ptr undef
10  icmp slt i8 %li8_0, %li8_1
11
12  %a0 = add i8 %li8_0, 1
13  %a1 = add i8 %li8_1, 1
14  icmp slt i8 %a0, %a1
15
16  icmp slt i8 %a0, 123
17
18  %li16_0 = load i16, ptr undef
19  %li16_1 = load i16, ptr undef
20  icmp slt i16 %li16_0, %li16_1
21
22  %a2 = add i16 %li16_0, 1
23  %a3 = add i16 %li16_1, 1
24  icmp slt i16 %a2, %a3
25
26  icmp slt i16 %a2, 123
27
28  ret void;
29; CHECK: function 'icmp'
30; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li8_0 = load i8, ptr undef
31; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li8_1 = load i8, ptr undef
32; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %1 = icmp slt i8 %li8_0, %li8_1
33; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %a0 = add i8 %li8_0, 1
34; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %a1 = add i8 %li8_1, 1
35; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %2 = icmp slt i8 %a0, %a1
36; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %3 = icmp slt i8 %a0, 123
37; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_0 = load i16, ptr undef
38; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16_1 = load i16, ptr undef
39; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = icmp slt i16 %li16_0, %li16_1
40; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %a2 = add i16 %li16_0, 1
41; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %a3 = add i16 %li16_1, 1
42; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %5 = icmp slt i16 %a2, %a3
43; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %6 = icmp slt i16 %a2, 123
44; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   ret void
45}
46