size-cost.ll
7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -cost-model -cost-kind=code-size -analyze -mtriple=x86_64-- | FileCheck %s
define i8 @trunc_i64_i8(i64 %x) {
; CHECK-LABEL: 'trunc_i64_i8'
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = trunc i64 %x to i8
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
;
%r = trunc i64 %x to i8
ret i8 %r
}
define i64 @sext_i8_i64(i8 %x) {
; CHECK-LABEL: 'sext_i8_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sext i8 %x to i64
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = sext i8 %x to i64
ret i64 %r
}
define i64 @zext_i8_i64(i8 %x) {
; CHECK-LABEL: 'zext_i8_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = zext i8 %x to i64
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = zext i8 %x to i64
ret i64 %r
}
define i64 @bitcast_f64_i64(double %x) {
; CHECK-LABEL: 'bitcast_f64_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast double %x to i64
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = bitcast double %x to i64
ret i64 %r
}
define double @bitcast_i64_f64(i64 %x) {
; CHECK-LABEL: 'bitcast_i64_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast i64 %x to double
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = bitcast i64 %x to double
ret double %r
}
define i64* @inttoptr_i64_p64(i64 %x) {
; CHECK-LABEL: 'inttoptr_i64_p64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = inttoptr i64 %x to i64*
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64* %r
;
%r = inttoptr i64 %x to i64*
ret i64* %r
}
define i64 @ptrtoint_p64_i64(i64* %x) {
; CHECK-LABEL: 'ptrtoint_p64_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = ptrtoint i64* %x to i64
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = ptrtoint i64* %x to i64
ret i64 %r
}
define i64 @add_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'add_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = add i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = add i64 %x, %y
ret i64 %r
}
define i64 @sub_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'sub_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sub i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = sub i64 %x, %y
ret i64 %r
}
define i64 @mul_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'mul_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = mul i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = mul i64 %x, %y
ret i64 %r
}
; FIXME: idiv is 1 instruction.
define i64 @sdiv_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'sdiv_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = sdiv i64 %x, %y
ret i64 %r
}
; FIXME: div is 1 instruction.
define i64 @udiv_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'udiv_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = udiv i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = udiv i64 %x, %y
ret i64 %r
}
; FIXME: idiv is 1 instruction.
define i64 @srem_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'srem_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = srem i64 %x, %y
ret i64 %r
}
; FIXME: div is 1 instruction.
define i64 @urem_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'urem_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = urem i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = urem i64 %x, %y
ret i64 %r
}
define i64 @ashr_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'ashr_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = ashr i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = ashr i64 %x, %y
ret i64 %r
}
define i64 @lshr_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'lshr_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = lshr i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = lshr i64 %x, %y
ret i64 %r
}
define i64 @shl_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'shl_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = shl i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = shl i64 %x, %y
ret i64 %r
}
define i64 @and_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'and_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = and i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = and i64 %x, %y
ret i64 %r
}
define i64 @or_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'or_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = or i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = or i64 %x, %y
ret i64 %r
}
define i64 @xor_i64(i64 %x, i64 %y) {
; CHECK-LABEL: 'xor_i64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = xor i64 %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
;
%r = xor i64 %x, %y
ret i64 %r
}
define double @fadd_f64(double %x, double %y) {
; CHECK-LABEL: 'fadd_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fadd double %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = fadd double %x, %y
ret double %r
}
define double @fsub_f64(double %x, double %y) {
; CHECK-LABEL: 'fsub_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fsub double %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = fsub double %x, %y
ret double %r
}
define double @fmul_f64(double %x, double %y) {
; CHECK-LABEL: 'fmul_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fmul double %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = fmul double %x, %y
ret double %r
}
; FIXME: divsd is 1 instruction.
define double @fdiv_f64(double %x, double %y) {
; CHECK-LABEL: 'fdiv_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = fdiv double %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = fdiv double %x, %y
ret double %r
}
; TODO: How does this lower?
define double @frem_f64(double %x, double %y) {
; CHECK-LABEL: 'frem_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = frem double %x, %y
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = frem double %x, %y
ret double %r
}
define double @fneg_f64(double %x) {
; CHECK-LABEL: 'fneg_f64'
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fneg double %x
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
;
%r = fneg double %x
ret double %r
}