xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/logical.ll (revision 964565f42eb8f06dc8610b44d56b432a8c2cb50b)
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2
3define void @and() {
4  %res0 = and i8 undef, undef
5  %res1 = and i16 undef, undef
6  %res2 = and i32 undef, undef
7  %res3 = and i64 undef, undef
8  %resQ = and i128 undef, undef
9  %res4 = and <2 x i8> undef, undef
10  %res5 = and <2 x i16> undef, undef
11  %res6 = and <2 x i32> undef, undef
12  %res7 = and <2 x i64> undef, undef
13  %res8 = and <4 x i8> undef, undef
14  %res9 = and <4 x i16> undef, undef
15  %res10 = and <4 x i32> undef, undef
16  %res11 = and <4 x i64> undef, undef
17  %res12 = and <8 x i8> undef, undef
18  %res13 = and <8 x i16> undef, undef
19  %res14 = and <8 x i32> undef, undef
20  %res15 = and <8 x i64> undef, undef
21  %res16 = and <16 x i8> undef, undef
22  %res17 = and <16 x i16> undef, undef
23  %res18 = and <16 x i32> undef, undef
24  %res19 = and <16 x i64> undef, undef
25
26; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = and i8 undef, undef
27; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = and i16 undef, undef
28; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = and i32 undef, undef
29; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = and i64 undef, undef
30; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = and i128 undef, undef
31; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = and <2 x i8> undef, undef
32; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = and <2 x i16> undef, undef
33; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = and <2 x i32> undef, undef
34; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = and <2 x i64> undef, undef
35; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = and <4 x i8> undef, undef
36; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = and <4 x i16> undef, undef
37; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = and <4 x i32> undef, undef
38; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = and <4 x i64> undef, undef
39; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = and <8 x i8> undef, undef
40; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = and <8 x i16> undef, undef
41; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = and <8 x i32> undef, undef
42; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = and <8 x i64> undef, undef
43; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = and <16 x i8> undef, undef
44; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = and <16 x i16> undef, undef
45; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = and <16 x i32> undef, undef
46; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = and <16 x i64> undef, undef
47
48  ret void;
49}
50
51define void @ashr() {
52  %res0 = ashr i8 undef, undef
53  %res1 = ashr i16 undef, undef
54  %res2 = ashr i32 undef, undef
55  %res3 = ashr i64 undef, undef
56  %resQ = ashr i128 undef, undef
57  %res4 = ashr <2 x i8> undef, undef
58  %res5 = ashr <2 x i16> undef, undef
59  %res6 = ashr <2 x i32> undef, undef
60  %res7 = ashr <2 x i64> undef, undef
61  %res8 = ashr <4 x i8> undef, undef
62  %res9 = ashr <4 x i16> undef, undef
63  %res10 = ashr <4 x i32> undef, undef
64  %res11 = ashr <4 x i64> undef, undef
65  %res12 = ashr <8 x i8> undef, undef
66  %res13 = ashr <8 x i16> undef, undef
67  %res14 = ashr <8 x i32> undef, undef
68  %res15 = ashr <8 x i64> undef, undef
69  %res16 = ashr <16 x i8> undef, undef
70  %res17 = ashr <16 x i16> undef, undef
71  %res18 = ashr <16 x i32> undef, undef
72  %res19 = ashr <16 x i64> undef, undef
73
74; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = ashr i8 undef, undef
75; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = ashr i16 undef, undef
76; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = ashr i32 undef, undef
77; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = ashr i64 undef, undef
78; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = ashr i128 undef, undef
79; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = ashr <2 x i8> undef, undef
80; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = ashr <2 x i16> undef, undef
81; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = ashr <2 x i32> undef, undef
82; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = ashr <2 x i64> undef, undef
83; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = ashr <4 x i8> undef, undef
84; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = ashr <4 x i16> undef, undef
85; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = ashr <4 x i32> undef, undef
86; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = ashr <4 x i64> undef, undef
87; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = ashr <8 x i8> undef, undef
88; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = ashr <8 x i16> undef, undef
89; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = ashr <8 x i32> undef, undef
90; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = ashr <8 x i64> undef, undef
91; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = ashr <16 x i8> undef, undef
92; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = ashr <16 x i16> undef, undef
93; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = ashr <16 x i32> undef, undef
94; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = ashr <16 x i64> undef, undef
95
96  ret void;
97}
98
99define void @lshr() {
100  %res0 = lshr i8 undef, undef
101  %res1 = lshr i16 undef, undef
102  %res2 = lshr i32 undef, undef
103  %res3 = lshr i64 undef, undef
104  %resQ = lshr i128 undef, undef
105  %res4 = lshr <2 x i8> undef, undef
106  %res5 = lshr <2 x i16> undef, undef
107  %res6 = lshr <2 x i32> undef, undef
108  %res7 = lshr <2 x i64> undef, undef
109  %res8 = lshr <4 x i8> undef, undef
110  %res9 = lshr <4 x i16> undef, undef
111  %res10 = lshr <4 x i32> undef, undef
112  %res11 = lshr <4 x i64> undef, undef
113  %res12 = lshr <8 x i8> undef, undef
114  %res13 = lshr <8 x i16> undef, undef
115  %res14 = lshr <8 x i32> undef, undef
116  %res15 = lshr <8 x i64> undef, undef
117  %res16 = lshr <16 x i8> undef, undef
118  %res17 = lshr <16 x i16> undef, undef
119  %res18 = lshr <16 x i32> undef, undef
120  %res19 = lshr <16 x i64> undef, undef
121
122; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = lshr i8 undef, undef
123; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = lshr i16 undef, undef
124; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = lshr i32 undef, undef
125; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = lshr i64 undef, undef
126; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = lshr i128 undef, undef
127; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = lshr <2 x i8> undef, undef
128; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = lshr <2 x i16> undef, undef
129; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = lshr <2 x i32> undef, undef
130; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = lshr <2 x i64> undef, undef
131; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = lshr <4 x i8> undef, undef
132; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = lshr <4 x i16> undef, undef
133; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = lshr <4 x i32> undef, undef
134; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = lshr <4 x i64> undef, undef
135; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = lshr <8 x i8> undef, undef
136; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = lshr <8 x i16> undef, undef
137; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = lshr <8 x i32> undef, undef
138; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = lshr <8 x i64> undef, undef
139; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = lshr <16 x i8> undef, undef
140; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = lshr <16 x i16> undef, undef
141; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = lshr <16 x i32> undef, undef
142; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = lshr <16 x i64> undef, undef
143
144  ret void;
145}
146
147define void @or() {
148  %res0 = or i8 undef, undef
149  %res1 = or i16 undef, undef
150  %res2 = or i32 undef, undef
151  %res3 = or i64 undef, undef
152  %resQ = or i128 undef, undef
153  %res4 = or <2 x i8> undef, undef
154  %res5 = or <2 x i16> undef, undef
155  %res6 = or <2 x i32> undef, undef
156  %res7 = or <2 x i64> undef, undef
157  %res8 = or <4 x i8> undef, undef
158  %res9 = or <4 x i16> undef, undef
159  %res10 = or <4 x i32> undef, undef
160  %res11 = or <4 x i64> undef, undef
161  %res12 = or <8 x i8> undef, undef
162  %res13 = or <8 x i16> undef, undef
163  %res14 = or <8 x i32> undef, undef
164  %res15 = or <8 x i64> undef, undef
165  %res16 = or <16 x i8> undef, undef
166  %res17 = or <16 x i16> undef, undef
167  %res18 = or <16 x i32> undef, undef
168  %res19 = or <16 x i64> undef, undef
169
170; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = or i8 undef, undef
171; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = or i16 undef, undef
172; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = or i32 undef, undef
173; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = or i64 undef, undef
174; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = or i128 undef, undef
175; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = or <2 x i8> undef, undef
176; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = or <2 x i16> undef, undef
177; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = or <2 x i32> undef, undef
178; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = or <2 x i64> undef, undef
179; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = or <4 x i8> undef, undef
180; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = or <4 x i16> undef, undef
181; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = or <4 x i32> undef, undef
182; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = or <4 x i64> undef, undef
183; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = or <8 x i8> undef, undef
184; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = or <8 x i16> undef, undef
185; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = or <8 x i32> undef, undef
186; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = or <8 x i64> undef, undef
187; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = or <16 x i8> undef, undef
188; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = or <16 x i16> undef, undef
189; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = or <16 x i32> undef, undef
190; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = or <16 x i64> undef, undef
191
192  ret void;
193}
194
195define void @shl() {
196  %res0 = shl i8 undef, undef
197  %res1 = shl i16 undef, undef
198  %res2 = shl i32 undef, undef
199  %res3 = shl i64 undef, undef
200  %resQ = shl i128 undef, undef
201  %res4 = shl <2 x i8> undef, undef
202  %res5 = shl <2 x i16> undef, undef
203  %res6 = shl <2 x i32> undef, undef
204  %res7 = shl <2 x i64> undef, undef
205  %res8 = shl <4 x i8> undef, undef
206  %res9 = shl <4 x i16> undef, undef
207  %res10 = shl <4 x i32> undef, undef
208  %res11 = shl <4 x i64> undef, undef
209  %res12 = shl <8 x i8> undef, undef
210  %res13 = shl <8 x i16> undef, undef
211  %res14 = shl <8 x i32> undef, undef
212  %res15 = shl <8 x i64> undef, undef
213  %res16 = shl <16 x i8> undef, undef
214  %res17 = shl <16 x i16> undef, undef
215  %res18 = shl <16 x i32> undef, undef
216  %res19 = shl <16 x i64> undef, undef
217
218; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = shl i8 undef, undef
219; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = shl i16 undef, undef
220; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = shl i32 undef, undef
221; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = shl i64 undef, undef
222; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = shl i128 undef, undef
223; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = shl <2 x i8> undef, undef
224; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = shl <2 x i16> undef, undef
225; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = shl <2 x i32> undef, undef
226; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = shl <2 x i64> undef, undef
227; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = shl <4 x i8> undef, undef
228; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = shl <4 x i16> undef, undef
229; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = shl <4 x i32> undef, undef
230; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = shl <4 x i64> undef, undef
231; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = shl <8 x i8> undef, undef
232; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = shl <8 x i16> undef, undef
233; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = shl <8 x i32> undef, undef
234; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = shl <8 x i64> undef, undef
235; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = shl <16 x i8> undef, undef
236; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = shl <16 x i16> undef, undef
237; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = shl <16 x i32> undef, undef
238; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = shl <16 x i64> undef, undef
239
240  ret void;
241}
242
243define void @xor() {
244  %res0 = xor i8 undef, undef
245  %res1 = xor i16 undef, undef
246  %res2 = xor i32 undef, undef
247  %res3 = xor i64 undef, undef
248  %resQ = xor i128 undef, undef
249  %res4 = xor <2 x i8> undef, undef
250  %res5 = xor <2 x i16> undef, undef
251  %res6 = xor <2 x i32> undef, undef
252  %res7 = xor <2 x i64> undef, undef
253  %res8 = xor <4 x i8> undef, undef
254  %res9 = xor <4 x i16> undef, undef
255  %res10 = xor <4 x i32> undef, undef
256  %res11 = xor <4 x i64> undef, undef
257  %res12 = xor <8 x i8> undef, undef
258  %res13 = xor <8 x i16> undef, undef
259  %res14 = xor <8 x i32> undef, undef
260  %res15 = xor <8 x i64> undef, undef
261  %res16 = xor <16 x i8> undef, undef
262  %res17 = xor <16 x i16> undef, undef
263  %res18 = xor <16 x i32> undef, undef
264  %res19 = xor <16 x i64> undef, undef
265
266; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res0 = xor i8 undef, undef
267; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res1 = xor i16 undef, undef
268; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res2 = xor i32 undef, undef
269; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res3 = xor i64 undef, undef
270; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %resQ = xor i128 undef, undef
271; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res4 = xor <2 x i8> undef, undef
272; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res5 = xor <2 x i16> undef, undef
273; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res6 = xor <2 x i32> undef, undef
274; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res7 = xor <2 x i64> undef, undef
275; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res8 = xor <4 x i8> undef, undef
276; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res9 = xor <4 x i16> undef, undef
277; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res10 = xor <4 x i32> undef, undef
278; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res11 = xor <4 x i64> undef, undef
279; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res12 = xor <8 x i8> undef, undef
280; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res13 = xor <8 x i16> undef, undef
281; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res14 = xor <8 x i32> undef, undef
282; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res15 = xor <8 x i64> undef, undef
283; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %res16 = xor <16 x i8> undef, undef
284; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %res17 = xor <16 x i16> undef, undef
285; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %res18 = xor <16 x i32> undef, undef
286; CHECK: Cost Model: Found an estimated cost of 8 for instruction:   %res19 = xor <16 x i64> undef, undef
287
288  ret void;
289}
290