1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=x86_64-- | FileCheck %s
4 define i8 @trunc_i64_i8(i64 %x) {
5 ; CHECK-LABEL: 'trunc_i64_i8'
6 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = trunc i64 %x to i8
7 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i8 %r
9 %r = trunc i64 %x to i8
13 define i64 @sext_i8_i64(i8 %x) {
14 ; CHECK-LABEL: 'sext_i8_i64'
15 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sext i8 %x to i64
16 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
18 %r = sext i8 %x to i64
22 define i64 @zext_i8_i64(i8 %x) {
23 ; CHECK-LABEL: 'zext_i8_i64'
24 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = zext i8 %x to i64
25 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
27 %r = zext i8 %x to i64
31 define i64 @bitcast_f64_i64(double %x) {
32 ; CHECK-LABEL: 'bitcast_f64_i64'
33 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast double %x to i64
34 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
36 %r = bitcast double %x to i64
40 define double @bitcast_i64_f64(i64 %x) {
41 ; CHECK-LABEL: 'bitcast_i64_f64'
42 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = bitcast i64 %x to double
43 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
45 %r = bitcast i64 %x to double
49 define ptr @inttoptr_i64_p64(i64 %x) {
50 ; CHECK-LABEL: 'inttoptr_i64_p64'
51 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = inttoptr i64 %x to ptr
52 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret ptr %r
54 %r = inttoptr i64 %x to ptr
58 define i64 @ptrtoint_p64_i64(ptr %x) {
59 ; CHECK-LABEL: 'ptrtoint_p64_i64'
60 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r = ptrtoint ptr %x to i64
61 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
63 %r = ptrtoint ptr %x to i64
67 define i64 @add_i64(i64 %x, i64 %y) {
68 ; CHECK-LABEL: 'add_i64'
69 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = add i64 %x, %y
70 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
76 define i64 @sub_i64(i64 %x, i64 %y) {
77 ; CHECK-LABEL: 'sub_i64'
78 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = sub i64 %x, %y
79 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
85 define i64 @mul_i64(i64 %x, i64 %y) {
86 ; CHECK-LABEL: 'mul_i64'
87 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = mul i64 %x, %y
88 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
94 ; FIXME: idiv is 1 instruction.
96 define i64 @sdiv_i64(i64 %x, i64 %y) {
97 ; CHECK-LABEL: 'sdiv_i64'
98 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = sdiv i64 %x, %y
99 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
105 ; FIXME: div is 1 instruction.
107 define i64 @udiv_i64(i64 %x, i64 %y) {
108 ; CHECK-LABEL: 'udiv_i64'
109 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = udiv i64 %x, %y
110 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
116 ; FIXME: idiv is 1 instruction.
118 define i64 @srem_i64(i64 %x, i64 %y) {
119 ; CHECK-LABEL: 'srem_i64'
120 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = srem i64 %x, %y
121 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
127 ; FIXME: div is 1 instruction.
129 define i64 @urem_i64(i64 %x, i64 %y) {
130 ; CHECK-LABEL: 'urem_i64'
131 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = urem i64 %x, %y
132 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
138 define i64 @ashr_i64(i64 %x, i64 %y) {
139 ; CHECK-LABEL: 'ashr_i64'
140 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = ashr i64 %x, %y
141 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
147 define i64 @lshr_i64(i64 %x, i64 %y) {
148 ; CHECK-LABEL: 'lshr_i64'
149 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = lshr i64 %x, %y
150 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
156 define i64 @shl_i64(i64 %x, i64 %y) {
157 ; CHECK-LABEL: 'shl_i64'
158 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = shl i64 %x, %y
159 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
165 define i64 @and_i64(i64 %x, i64 %y) {
166 ; CHECK-LABEL: 'and_i64'
167 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = and i64 %x, %y
168 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
174 define i64 @or_i64(i64 %x, i64 %y) {
175 ; CHECK-LABEL: 'or_i64'
176 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = or i64 %x, %y
177 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
183 define i64 @xor_i64(i64 %x, i64 %y) {
184 ; CHECK-LABEL: 'xor_i64'
185 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = xor i64 %x, %y
186 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r
192 define double @fadd_f64(double %x, double %y) {
193 ; CHECK-LABEL: 'fadd_f64'
194 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fadd double %x, %y
195 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
197 %r = fadd double %x, %y
201 define double @fsub_f64(double %x, double %y) {
202 ; CHECK-LABEL: 'fsub_f64'
203 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fsub double %x, %y
204 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
206 %r = fsub double %x, %y
210 define double @fmul_f64(double %x, double %y) {
211 ; CHECK-LABEL: 'fmul_f64'
212 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fmul double %x, %y
213 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
215 %r = fmul double %x, %y
219 ; divsd is 1 instruction.
221 define double @fdiv_f64(double %x, double %y) {
222 ; CHECK-LABEL: 'fdiv_f64'
223 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fdiv double %x, %y
224 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
226 %r = fdiv double %x, %y
230 ; TODO: How does this lower?
232 define double @frem_f64(double %x, double %y) {
233 ; CHECK-LABEL: 'frem_f64'
234 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r = frem double %x, %y
235 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r
237 %r = frem double %x, %y
241 define double @fneg_f64(double %x) {
242 ; CHECK-LABEL: 'fneg_f64'
243 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r = fneg double %x
244 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret double %r