xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/int-arith.ll (revision 8424bf207efd89eacf2fe893b67be98d535e1db6)
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=arch15 | FileCheck %s -check-prefix=ARC15
3;
4; Note: The scalarized vector instructions costs are not including any
5; extracts, due to the undef operands.
6
7define void @add() {
8  %res0 = add i8 undef, undef
9  %res1 = add i16 undef, undef
10  %res2 = add i32 undef, undef
11  %res3 = add i64 undef, undef
12  %resQ = add i128 undef, undef
13  %res4 = add <2 x i8> undef, undef
14  %res5 = add <2 x i16> undef, undef
15  %res6 = add <2 x i32> undef, undef
16  %res7 = add <2 x i64> undef, undef
17  %res8 = add <4 x i8> undef, undef
18  %res9 = add <4 x i16> undef, undef
19  %res10 = add <4 x i32> undef, undef
20  %res11 = add <4 x i64> undef, undef
21  %res12 = add <8 x i8> undef, undef
22  %res13 = add <8 x i16> undef, undef
23  %res14 = add <8 x i32> undef, undef
24  %res15 = add <8 x i64> undef, undef
25  %res16 = add <16 x i8> undef, undef
26  %res17 = add <16 x i16> undef, undef
27  %res18 = add <16 x i32> undef, undef
28  %res19 = add <16 x i64> undef, undef
29
30; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = add i8 undef, undef
31; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = add i16 undef, undef
32; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = add i32 undef, undef
33; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = add i64 undef, undef
34; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = add i128 undef, undef
35; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = add <2 x i8> undef, undef
36; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = add <2 x i16> undef, undef
37; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = add <2 x i32> undef, undef
38; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = add <2 x i64> undef, undef
39; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = add <4 x i8> undef, undef
40; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = add <4 x i16> undef, undef
41; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = add <4 x i32> undef, undef
42; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = add <4 x i64> undef, undef
43; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = add <8 x i8> undef, undef
44; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = add <8 x i16> undef, undef
45; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = add <8 x i32> undef, undef
46; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = add <8 x i64> undef, undef
47; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = add <16 x i8> undef, undef
48; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = add <16 x i16> undef, undef
49; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = add <16 x i32> undef, undef
50; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = add <16 x i64> undef, undef
51
52  ret void;
53}
54
55define void @sub() {
56  %res0 = sub i8 undef, undef
57  %res1 = sub i16 undef, undef
58  %res2 = sub i32 undef, undef
59  %res3 = sub i64 undef, undef
60  %resQ = sub i128 undef, undef
61  %res4 = sub <2 x i8> undef, undef
62  %res5 = sub <2 x i16> undef, undef
63  %res6 = sub <2 x i32> undef, undef
64  %res7 = sub <2 x i64> undef, undef
65  %res8 = sub <4 x i8> undef, undef
66  %res9 = sub <4 x i16> undef, undef
67  %res10 = sub <4 x i32> undef, undef
68  %res11 = sub <4 x i64> undef, undef
69  %res12 = sub <8 x i8> undef, undef
70  %res13 = sub <8 x i16> undef, undef
71  %res14 = sub <8 x i32> undef, undef
72  %res15 = sub <8 x i64> undef, undef
73  %res16 = sub <16 x i8> undef, undef
74  %res17 = sub <16 x i16> undef, undef
75  %res18 = sub <16 x i32> undef, undef
76  %res19 = sub <16 x i64> undef, undef
77
78; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = sub i8 undef, undef
79; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = sub i16 undef, undef
80; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = sub i32 undef, undef
81; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = sub i64 undef, undef
82; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = sub i128 undef, undef
83; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = sub <2 x i8> undef, undef
84; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = sub <2 x i16> undef, undef
85; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = sub <2 x i32> undef, undef
86; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = sub <2 x i64> undef, undef
87; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = sub <4 x i8> undef, undef
88; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = sub <4 x i16> undef, undef
89; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = sub <4 x i32> undef, undef
90; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = sub <4 x i64> undef, undef
91; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = sub <8 x i8> undef, undef
92; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = sub <8 x i16> undef, undef
93; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = sub <8 x i32> undef, undef
94; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = sub <8 x i64> undef, undef
95; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = sub <16 x i8> undef, undef
96; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = sub <16 x i16> undef, undef
97; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = sub <16 x i32> undef, undef
98; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = sub <16 x i64> undef, undef
99
100  ret void;
101}
102
103define void @mul() {
104  %res0 = mul i8 undef, undef
105  %res1 = mul i16 undef, undef
106  %res2 = mul i32 undef, undef
107  %res3 = mul i64 undef, undef
108  %resQ = mul i128 undef, undef
109  %res4 = mul <2 x i8> undef, undef
110  %res5 = mul <2 x i16> undef, undef
111  %res6 = mul <2 x i32> undef, undef
112  %res7 = mul <2 x i64> undef, undef
113  %res8 = mul <4 x i8> undef, undef
114  %res9 = mul <4 x i16> undef, undef
115  %res10 = mul <4 x i32> undef, undef
116  %res11 = mul <4 x i64> undef, undef
117  %res12 = mul <8 x i8> undef, undef
118  %res13 = mul <8 x i16> undef, undef
119  %res14 = mul <8 x i32> undef, undef
120  %res15 = mul <8 x i64> undef, undef
121  %res16 = mul <16 x i8> undef, undef
122  %res17 = mul <16 x i16> undef, undef
123  %res18 = mul <16 x i32> undef, undef
124  %res19 = mul <16 x i64> undef, undef
125
126; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = mul i8 undef, undef
127; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = mul i16 undef, undef
128; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = mul i32 undef, undef
129; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = mul i64 undef, undef
130; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = mul i128 undef, undef
131; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = mul <2 x i8> undef, undef
132; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = mul <2 x i16> undef, undef
133; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = mul <2 x i32> undef, undef
134; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %res7 = mul <2 x i64> undef, undef
135; ARC15: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = mul <2 x i64> undef, undef
136; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = mul <4 x i8> undef, undef
137; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = mul <4 x i16> undef, undef
138; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = mul <4 x i32> undef, undef
139; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %res11 = mul <4 x i64> undef, undef
140; ARC15: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = mul <4 x i64> undef, undef
141; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = mul <8 x i8> undef, undef
142; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = mul <8 x i16> undef, undef
143; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = mul <8 x i32> undef, undef
144; CHECK: Cost Model: Found an estimated cost of 12 for instruction:   %res15 = mul <8 x i64> undef, undef
145; ARC15: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = mul <8 x i64> undef, undef
146; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = mul <16 x i8> undef, undef
147; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = mul <16 x i16> undef, undef
148; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = mul <16 x i32> undef, undef
149; CHECK: Cost Model: Found an estimated cost of 24 for instruction:   %res19 = mul <16 x i64> undef, undef
150; ARC15: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = mul <16 x i64> undef, undef
151
152  ret void;
153}
154