• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2
3define void @sext() {
4  %v0 = sext i8 undef to i16
5  %v1 = sext i8 undef to i32
6  %v2 = sext i8 undef to i64
7  %v3 = sext i16 undef to i32
8  %v4 = sext i16 undef to i64
9  %v5 = sext i32 undef to i64
10  %v6 = sext <2 x i8> undef to <2 x i16>
11  %v7 = sext <2 x i8> undef to <2 x i32>
12  %v8 = sext <2 x i8> undef to <2 x i64>
13  %v9 = sext <2 x i16> undef to <2 x i32>
14  %v10 = sext <2 x i16> undef to <2 x i64>
15  %v11 = sext <2 x i32> undef to <2 x i64>
16  %v12 = sext <4 x i8> undef to <4 x i16>
17  %v13 = sext <4 x i8> undef to <4 x i32>
18  %v14 = sext <4 x i8> undef to <4 x i64>
19  %v15 = sext <4 x i16> undef to <4 x i32>
20  %v16 = sext <4 x i16> undef to <4 x i64>
21  %v17 = sext <4 x i32> undef to <4 x i64>
22  %v18 = sext <8 x i8> undef to <8 x i16>
23  %v19 = sext <8 x i8> undef to <8 x i32>
24  %v20 = sext <8 x i8> undef to <8 x i64>
25  %v21 = sext <8 x i16> undef to <8 x i32>
26  %v22 = sext <8 x i16> undef to <8 x i64>
27  %v23 = sext <8 x i32> undef to <8 x i64>
28  %v24 = sext <16 x i8> undef to <16 x i16>
29  %v25 = sext <16 x i8> undef to <16 x i32>
30  %v26 = sext <16 x i8> undef to <16 x i64>
31  %v27 = sext <16 x i16> undef to <16 x i32>
32  %v28 = sext <16 x i16> undef to <16 x i64>
33  %v29 = sext <16 x i32> undef to <16 x i64>
34
35; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v0 = sext i8 undef to i16
36; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v1 = sext i8 undef to i32
37; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v2 = sext i8 undef to i64
38; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v3 = sext i16 undef to i32
39; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v4 = sext i16 undef to i64
40; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v5 = sext i32 undef to i64
41; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v6 = sext <2 x i8> undef to <2 x i16>
42; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v7 = sext <2 x i8> undef to <2 x i32>
43; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v8 = sext <2 x i8> undef to <2 x i64>
44; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v9 = sext <2 x i16> undef to <2 x i32>
45; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v10 = sext <2 x i16> undef to <2 x i64>
46; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v11 = sext <2 x i32> undef to <2 x i64>
47; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v12 = sext <4 x i8> undef to <4 x i16>
48; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v13 = sext <4 x i8> undef to <4 x i32>
49; CHECK: Cost Model: Found an estimated cost of 7 for instruction:   %v14 = sext <4 x i8> undef to <4 x i64>
50; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v15 = sext <4 x i16> undef to <4 x i32>
51; CHECK: Cost Model: Found an estimated cost of 5 for instruction:   %v16 = sext <4 x i16> undef to <4 x i64>
52; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v17 = sext <4 x i32> undef to <4 x i64>
53; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v18 = sext <8 x i8> undef to <8 x i16>
54; CHECK: Cost Model: Found an estimated cost of 5 for instruction:   %v19 = sext <8 x i8> undef to <8 x i32>
55; CHECK: Cost Model: Found an estimated cost of 15 for instruction:   %v20 = sext <8 x i8> undef to <8 x i64>
56; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v21 = sext <8 x i16> undef to <8 x i32>
57; CHECK: Cost Model: Found an estimated cost of 11 for instruction:   %v22 = sext <8 x i16> undef to <8 x i64>
58; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %v23 = sext <8 x i32> undef to <8 x i64>
59; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v24 = sext <16 x i8> undef to <16 x i16>
60; CHECK: Cost Model: Found an estimated cost of 11 for instruction:   %v25 = sext <16 x i8> undef to <16 x i32>
61; CHECK: Cost Model: Found an estimated cost of 31 for instruction:   %v26 = sext <16 x i8> undef to <16 x i64>
62; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %v27 = sext <16 x i16> undef to <16 x i32>
63; CHECK: Cost Model: Found an estimated cost of 22 for instruction:   %v28 = sext <16 x i16> undef to <16 x i64>
64; CHECK: Cost Model: Found an estimated cost of 12 for instruction:   %v29 = sext <16 x i32> undef to <16 x i64>
65
66 ret void
67}
68
69define void @zext() {
70  %v0 = zext i8 undef to i16
71  %v1 = zext i8 undef to i32
72  %v2 = zext i8 undef to i64
73  %v3 = zext i16 undef to i32
74  %v4 = zext i16 undef to i64
75  %v5 = zext i32 undef to i64
76  %v6 = zext <2 x i8> undef to <2 x i16>
77  %v7 = zext <2 x i8> undef to <2 x i32>
78  %v8 = zext <2 x i8> undef to <2 x i64>
79  %v9 = zext <2 x i16> undef to <2 x i32>
80  %v10 = zext <2 x i16> undef to <2 x i64>
81  %v11 = zext <2 x i32> undef to <2 x i64>
82  %v12 = zext <4 x i8> undef to <4 x i16>
83  %v13 = zext <4 x i8> undef to <4 x i32>
84  %v14 = zext <4 x i8> undef to <4 x i64>
85  %v15 = zext <4 x i16> undef to <4 x i32>
86  %v16 = zext <4 x i16> undef to <4 x i64>
87  %v17 = zext <4 x i32> undef to <4 x i64>
88  %v18 = zext <8 x i8> undef to <8 x i16>
89  %v19 = zext <8 x i8> undef to <8 x i32>
90  %v20 = zext <8 x i8> undef to <8 x i64>
91  %v21 = zext <8 x i16> undef to <8 x i32>
92  %v22 = zext <8 x i16> undef to <8 x i64>
93  %v23 = zext <8 x i32> undef to <8 x i64>
94  %v24 = zext <16 x i8> undef to <16 x i16>
95  %v25 = zext <16 x i8> undef to <16 x i32>
96  %v26 = zext <16 x i8> undef to <16 x i64>
97  %v27 = zext <16 x i16> undef to <16 x i32>
98  %v28 = zext <16 x i16> undef to <16 x i64>
99  %v29 = zext <16 x i32> undef to <16 x i64>
100
101; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v0 = zext i8 undef to i16
102; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v1 = zext i8 undef to i32
103; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v2 = zext i8 undef to i64
104; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v3 = zext i16 undef to i32
105; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v4 = zext i16 undef to i64
106; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v5 = zext i32 undef to i64
107; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v6 = zext <2 x i8> undef to <2 x i16>
108; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v7 = zext <2 x i8> undef to <2 x i32>
109; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v8 = zext <2 x i8> undef to <2 x i64>
110; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v9 = zext <2 x i16> undef to <2 x i32>
111; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v10 = zext <2 x i16> undef to <2 x i64>
112; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v11 = zext <2 x i32> undef to <2 x i64>
113; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v12 = zext <4 x i8> undef to <4 x i16>
114; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v13 = zext <4 x i8> undef to <4 x i32>
115; CHECK: Cost Model: Found an estimated cost of 7 for instruction:   %v14 = zext <4 x i8> undef to <4 x i64>
116; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v15 = zext <4 x i16> undef to <4 x i32>
117; CHECK: Cost Model: Found an estimated cost of 5 for instruction:   %v16 = zext <4 x i16> undef to <4 x i64>
118; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v17 = zext <4 x i32> undef to <4 x i64>
119; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v18 = zext <8 x i8> undef to <8 x i16>
120; CHECK: Cost Model: Found an estimated cost of 5 for instruction:   %v19 = zext <8 x i8> undef to <8 x i32>
121; CHECK: Cost Model: Found an estimated cost of 15 for instruction:   %v20 = zext <8 x i8> undef to <8 x i64>
122; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v21 = zext <8 x i16> undef to <8 x i32>
123; CHECK: Cost Model: Found an estimated cost of 11 for instruction:   %v22 = zext <8 x i16> undef to <8 x i64>
124; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %v23 = zext <8 x i32> undef to <8 x i64>
125; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v24 = zext <16 x i8> undef to <16 x i16>
126; CHECK: Cost Model: Found an estimated cost of 11 for instruction:   %v25 = zext <16 x i8> undef to <16 x i32>
127; CHECK: Cost Model: Found an estimated cost of 31 for instruction:   %v26 = zext <16 x i8> undef to <16 x i64>
128; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %v27 = zext <16 x i16> undef to <16 x i32>
129; CHECK: Cost Model: Found an estimated cost of 22 for instruction:   %v28 = zext <16 x i16> undef to <16 x i64>
130; CHECK: Cost Model: Found an estimated cost of 12 for instruction:   %v29 = zext <16 x i32> undef to <16 x i64>
131
132 ret void
133}
134
135define void @trunc() {
136  %v0 = trunc i16 undef to i8
137  %v1 = trunc i32 undef to i16
138  %v2 = trunc i32 undef to i8
139  %v3 = trunc i64 undef to i32
140  %v4 = trunc i64 undef to i16
141  %v5 = trunc i64 undef to i8
142  %v6 = trunc <2 x i16> undef to <2 x i8>
143  %v7 = trunc <2 x i32> undef to <2 x i16>
144  %v8 = trunc <2 x i32> undef to <2 x i8>
145  %v9 = trunc <2 x i64> undef to <2 x i32>
146  %v10 = trunc <2 x i64> undef to <2 x i16>
147  %v11 = trunc <2 x i64> undef to <2 x i8>
148  %v12 = trunc <4 x i16> undef to <4 x i8>
149  %v13 = trunc <4 x i32> undef to <4 x i16>
150  %v14 = trunc <4 x i32> undef to <4 x i8>
151  %v15 = trunc <4 x i64> undef to <4 x i32>
152  %v16 = trunc <4 x i64> undef to <4 x i16>
153  %v17 = trunc <4 x i64> undef to <4 x i8>
154  %v18 = trunc <8 x i16> undef to <8 x i8>
155  %v19 = trunc <8 x i32> undef to <8 x i16>
156  %v20 = trunc <8 x i32> undef to <8 x i8>
157  %v21 = trunc <8 x i64> undef to <8 x i32>
158  %v22 = trunc <8 x i64> undef to <8 x i16>
159  %v23 = trunc <8 x i64> undef to <8 x i8>
160  %v24 = trunc <16 x i16> undef to <16 x i8>
161  %v25 = trunc <16 x i32> undef to <16 x i16>
162  %v26 = trunc <16 x i32> undef to <16 x i8>
163  %v27 = trunc <16 x i64> undef to <16 x i32>
164  %v28 = trunc <16 x i64> undef to <16 x i16>
165  %v29 = trunc <16 x i64> undef to <16 x i8>
166
167; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v0 = trunc i16 undef to i8
168; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v1 = trunc i32 undef to i16
169; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v2 = trunc i32 undef to i8
170; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v3 = trunc i64 undef to i32
171; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v4 = trunc i64 undef to i16
172; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %v5 = trunc i64 undef to i8
173; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v6 = trunc <2 x i16> undef to <2 x i8>
174; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v7 = trunc <2 x i32> undef to <2 x i16>
175; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v8 = trunc <2 x i32> undef to <2 x i8>
176; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v9 = trunc <2 x i64> undef to <2 x i32>
177; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v10 = trunc <2 x i64> undef to <2 x i16>
178; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v11 = trunc <2 x i64> undef to <2 x i8>
179; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v12 = trunc <4 x i16> undef to <4 x i8>
180; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v13 = trunc <4 x i32> undef to <4 x i16>
181; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v14 = trunc <4 x i32> undef to <4 x i8>
182; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v15 = trunc <4 x i64> undef to <4 x i32>
183; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v16 = trunc <4 x i64> undef to <4 x i16>
184; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v17 = trunc <4 x i64> undef to <4 x i8>
185; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v18 = trunc <8 x i16> undef to <8 x i8>
186; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v19 = trunc <8 x i32> undef to <8 x i16>
187; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v20 = trunc <8 x i32> undef to <8 x i8>
188; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v21 = trunc <8 x i64> undef to <8 x i32>
189; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v22 = trunc <8 x i64> undef to <8 x i16>
190; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v23 = trunc <8 x i64> undef to <8 x i8>
191; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %v24 = trunc <16 x i16> undef to <16 x i8>
192; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %v25 = trunc <16 x i32> undef to <16 x i16>
193; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %v26 = trunc <16 x i32> undef to <16 x i8>
194; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %v27 = trunc <16 x i64> undef to <16 x i32>
195; CHECK: Cost Model: Found an estimated cost of 6 for instruction:   %v28 = trunc <16 x i64> undef to <16 x i16>
196; CHECK: Cost Model: Found an estimated cost of 7 for instruction:   %v29 = trunc <16 x i64> undef to <16 x i8>
197
198 ret void
199}
200