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