1 ; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=cortex-a8 | FileCheck %s
2 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
3 target triple = "thumbv7-apple-ios6.0.0"
8 ; CHECK: cost of 1 {{.*}} sext
9 %r0 = sext i1 undef to i8
10 ; CHECK: cost of 1 {{.*}} zext
11 %r1 = zext i1 undef to i8
12 ; CHECK: cost of 1 {{.*}} sext
13 %r2 = sext i1 undef to i16
14 ; CHECK: cost of 1 {{.*}} zext
15 %r3 = zext i1 undef to i16
16 ; CHECK: cost of 1 {{.*}} sext
17 %r4 = sext i1 undef to i32
18 ; CHECK: cost of 1 {{.*}} zext
19 %r5 = zext i1 undef to i32
20 ; CHECK: cost of 1 {{.*}} sext
21 %r6 = sext i1 undef to i64
22 ; CHECK: cost of 1 {{.*}} zext
23 %r7 = zext i1 undef to i64
24 ; CHECK: cost of 0 {{.*}} trunc
25 %r8 = trunc i8 undef to i1
26 ; CHECK: cost of 1 {{.*}} sext
27 %r9 = sext i8 undef to i16
28 ; CHECK: cost of 1 {{.*}} zext
29 %r10 = zext i8 undef to i16
30 ; CHECK: cost of 1 {{.*}} sext
31 %r11 = sext i8 undef to i32
32 ; CHECK: cost of 1 {{.*}} zext
33 %r12 = zext i8 undef to i32
34 ; CHECK: cost of 1 {{.*}} sext
35 %r13 = sext i8 undef to i64
36 ; CHECK: cost of 1 {{.*}} zext
37 %r14 = zext i8 undef to i64
38 ; CHECK: cost of 0 {{.*}} trunc
39 %r15 = trunc i16 undef to i1
40 ; CHECK: cost of 0 {{.*}} trunc
41 %r16 = trunc i16 undef to i8
42 ; CHECK: cost of 1 {{.*}} sext
43 %r17 = sext i16 undef to i32
44 ; CHECK: cost of 1 {{.*}} zext
45 %r18 = zext i16 undef to i32
46 ; CHECK: cost of 2 {{.*}} sext
47 %r19 = sext i16 undef to i64
48 ; CHECK: cost of 1 {{.*}} zext
49 %r20 = zext i16 undef to i64
50 ; CHECK: cost of 0 {{.*}} trunc
51 %r21 = trunc i32 undef to i1
52 ; CHECK: cost of 0 {{.*}} trunc
53 %r22 = trunc i32 undef to i8
54 ; CHECK: cost of 0 {{.*}} trunc
55 %r23 = trunc i32 undef to i16
56 ; CHECK: cost of 1 {{.*}} sext
57 %r24 = sext i32 undef to i64
58 ; CHECK: cost of 1 {{.*}} zext
59 %r25 = zext i32 undef to i64
60 ; CHECK: cost of 0 {{.*}} trunc
61 %r26 = trunc i64 undef to i1
62 ; CHECK: cost of 0 {{.*}} trunc
63 %r27 = trunc i64 undef to i8
64 ; CHECK: cost of 0 {{.*}} trunc
65 %r28 = trunc i64 undef to i16
66 ; CHECK: cost of 0 {{.*}} trunc
67 %r29 = trunc i64 undef to i32
69 ; -- floating point conversions --
70 ; Moves between scalar and NEON registers.
71 ; CHECK: cost of 2 {{.*}} fptoui
72 %r30 = fptoui float undef to i1
73 ; CHECK: cost of 2 {{.*}} fptosi
74 %r31 = fptosi float undef to i1
75 ; CHECK: cost of 2 {{.*}} fptoui
76 %r32 = fptoui float undef to i8
77 ; CHECK: cost of 2 {{.*}} fptosi
78 %r33 = fptosi float undef to i8
79 ; CHECK: cost of 2 {{.*}} fptoui
80 %r34 = fptoui float undef to i16
81 ; CHECK: cost of 2 {{.*}} fptosi
82 %r35 = fptosi float undef to i16
83 ; CHECK: cost of 2 {{.*}} fptoui
84 %r36 = fptoui float undef to i32
85 ; CHECK: cost of 2 {{.*}} fptosi
86 %r37 = fptosi float undef to i32
87 ; CHECK: cost of 10 {{.*}} fptoui
88 %r38 = fptoui float undef to i64
89 ; CHECK: cost of 10 {{.*}} fptosi
90 %r39 = fptosi float undef to i64
91 ; CHECK: cost of 2 {{.*}} fptoui
92 %r40 = fptoui double undef to i1
93 ; CHECK: cost of 2 {{.*}} fptosi
94 %r41 = fptosi double undef to i1
95 ; CHECK: cost of 2 {{.*}} fptoui
96 %r42 = fptoui double undef to i8
97 ; CHECK: cost of 2 {{.*}} fptosi
98 %r43 = fptosi double undef to i8
99 ; CHECK: cost of 2 {{.*}} fptoui
100 %r44 = fptoui double undef to i16
101 ; CHECK: cost of 2 {{.*}} fptosi
102 %r45 = fptosi double undef to i16
103 ; CHECK: cost of 2 {{.*}} fptoui
104 %r46 = fptoui double undef to i32
105 ; CHECK: cost of 2 {{.*}} fptosi
106 %r47 = fptosi double undef to i32
108 ; CHECK: cost of 10 {{.*}} fptoui
109 %r48 = fptoui double undef to i64
110 ; CHECK: cost of 10 {{.*}} fptosi
111 %r49 = fptosi double undef to i64
113 ; CHECK: cost of 2 {{.*}} sitofp
114 %r50 = sitofp i1 undef to float
115 ; CHECK: cost of 2 {{.*}} uitofp
116 %r51 = uitofp i1 undef to float
117 ; CHECK: cost of 2 {{.*}} sitofp
118 %r52 = sitofp i1 undef to double
119 ; CHECK: cost of 2 {{.*}} uitofp
120 %r53 = uitofp i1 undef to double
121 ; CHECK: cost of 2 {{.*}} sitofp
122 %r54 = sitofp i8 undef to float
123 ; CHECK: cost of 2 {{.*}} uitofp
124 %r55 = uitofp i8 undef to float
125 ; CHECK: cost of 2 {{.*}} sitofp
126 %r56 = sitofp i8 undef to double
127 ; CHECK: cost of 2 {{.*}} uitofp
128 %r57 = uitofp i8 undef to double
129 ; CHECK: cost of 2 {{.*}} sitofp
130 %r58 = sitofp i16 undef to float
131 ; CHECK: cost of 2 {{.*}} uitofp
132 %r59 = uitofp i16 undef to float
133 ; CHECK: cost of 2 {{.*}} sitofp
134 %r60 = sitofp i16 undef to double
135 ; CHECK: cost of 2 {{.*}} uitofp
136 %r61 = uitofp i16 undef to double
137 ; CHECK: cost of 2 {{.*}} sitofp
138 %r62 = sitofp i32 undef to float
139 ; CHECK: cost of 2 {{.*}} uitofp
140 %r63 = uitofp i32 undef to float
141 ; CHECK: cost of 2 {{.*}} sitofp
142 %r64 = sitofp i32 undef to double
143 ; CHECK: cost of 2 {{.*}} uitofp
144 %r65 = uitofp i32 undef to double
146 ; CHECK: cost of 10 {{.*}} sitofp
147 %r66 = sitofp i64 undef to float
148 ; CHECK: cost of 10 {{.*}} uitofp
149 %r67 = uitofp i64 undef to float
150 ; CHECK: cost of 10 {{.*}} sitofp
151 %r68 = sitofp i64 undef to double
152 ; CHECK: cost of 10 {{.*}} uitofp
153 %r69 = uitofp i64 undef to double
155 ; Vector cast cost of instructions lowering the cast to the stack.
156 ; CHECK: cost of 24 {{.*}} sext
157 %r70 = sext <8 x i8> undef to <8 x i32>
158 ; CHECK: cost of 48 {{.*}} sext
159 %r71 = sext <16 x i8> undef to <16 x i32>
160 ; CHECK: cost of 22 {{.*}} zext
161 %r72 = zext <8 x i8> undef to <8 x i32>
162 ; CHECK: cost of 44 {{.*}} zext
163 %r73 = zext <16 x i8> undef to <16 x i32>
164 ; CHECK: cost of 19 {{.*}} trunc
165 %r74 = trunc <8 x i32> undef to <8 x i8>
166 ; CHECK: cost of 38 {{.*}} trunc
167 %r75 = trunc <16 x i32> undef to <16 x i8>
169 ; Floating point truncation costs.
170 ; CHECK: cost of 1 {{.*}} fptrunc double
171 %r80 = fptrunc double undef to float
172 ; CHECK: cost of 2 {{.*}} fptrunc <2 x double
173 %r81 = fptrunc <2 x double> undef to <2 x float>
174 ; CHECK: cost of 4 {{.*}} fptrunc <4 x double
175 %r82 = fptrunc <4 x double> undef to <4 x float>
176 ; CHECK: cost of 8 {{.*}} fptrunc <8 x double
177 %r83 = fptrunc <8 x double> undef to <8 x float>
178 ; CHECK: cost of 16 {{.*}} fptrunc <16 x double
179 %r84 = fptrunc <16 x double> undef to <16 x float>
181 ; Floating point extension costs.
182 ; CHECK: cost of 1 {{.*}} fpext float
183 %r85 = fpext float undef to double
184 ; CHECK: cost of 2 {{.*}} fpext <2 x float
185 %r86 = fpext <2 x float> undef to <2 x double>
186 ; CHECK: cost of 4 {{.*}} fpext <4 x float
187 %r87 = fpext <4 x float> undef to <4 x double>
188 ; CHECK: cost of 8 {{.*}} fpext <8 x float
189 %r88 = fpext <8 x float> undef to <8 x double>
190 ; CHECK: cost of 16 {{.*}} fpext <16 x float
191 %r89 = fpext <16 x float> undef to <16 x double>
193 ;; Floating point to integer vector casts.
194 ; CHECK: cost of 1 {{.*}} fptoui
195 %r90 = fptoui <2 x float> undef to <2 x i1>
196 ; CHECK: cost of 1 {{.*}} fptosi
197 %r91 = fptosi <2 x float> undef to <2 x i1>
198 ; CHECK: cost of 1 {{.*}} fptoui
199 %r92 = fptoui <2 x float> undef to <2 x i8>
200 ; CHECK: cost of 1 {{.*}} fptosi
201 %r93 = fptosi <2 x float> undef to <2 x i8>
202 ; CHECK: cost of 1 {{.*}} fptoui
203 %r94 = fptoui <2 x float> undef to <2 x i16>
204 ; CHECK: cost of 1 {{.*}} fptosi
205 %r95 = fptosi <2 x float> undef to <2 x i16>
206 ; CHECK: cost of 1 {{.*}} fptoui
207 %r96 = fptoui <2 x float> undef to <2 x i32>
208 ; CHECK: cost of 1 {{.*}} fptosi
209 %r97 = fptosi <2 x float> undef to <2 x i32>
210 ; CHECK: cost of 24 {{.*}} fptoui
211 %r98 = fptoui <2 x float> undef to <2 x i64>
212 ; CHECK: cost of 24 {{.*}} fptosi
213 %r99 = fptosi <2 x float> undef to <2 x i64>
215 ; CHECK: cost of 8 {{.*}} fptoui
216 %r100 = fptoui <2 x double> undef to <2 x i1>
217 ; CHECK: cost of 8 {{.*}} fptosi
218 %r101 = fptosi <2 x double> undef to <2 x i1>
219 ; CHECK: cost of 8 {{.*}} fptoui
220 %r102 = fptoui <2 x double> undef to <2 x i8>
221 ; CHECK: cost of 8 {{.*}} fptosi
222 %r103 = fptosi <2 x double> undef to <2 x i8>
223 ; CHECK: cost of 8 {{.*}} fptoui
224 %r104 = fptoui <2 x double> undef to <2 x i16>
225 ; CHECK: cost of 8 {{.*}} fptosi
226 %r105 = fptosi <2 x double> undef to <2 x i16>
227 ; CHECK: cost of 2 {{.*}} fptoui
228 %r106 = fptoui <2 x double> undef to <2 x i32>
229 ; CHECK: cost of 2 {{.*}} fptosi
230 %r107 = fptosi <2 x double> undef to <2 x i32>
231 ; CHECK: cost of 24 {{.*}} fptoui
232 %r108 = fptoui <2 x double> undef to <2 x i64>
233 ; CHECK: cost of 24 {{.*}} fptosi
234 %r109 = fptosi <2 x double> undef to <2 x i64>
236 ; CHECK: cost of 16 {{.*}} fptoui
237 %r110 = fptoui <4 x float> undef to <4 x i1>
238 ; CHECK: cost of 16 {{.*}} fptosi
239 %r111 = fptosi <4 x float> undef to <4 x i1>
240 ; CHECK: cost of 3 {{.*}} fptoui
241 %r112 = fptoui <4 x float> undef to <4 x i8>
242 ; CHECK: cost of 3 {{.*}} fptosi
243 %r113 = fptosi <4 x float> undef to <4 x i8>
244 ; CHECK: cost of 2 {{.*}} fptoui
245 %r114 = fptoui <4 x float> undef to <4 x i16>
246 ; CHECK: cost of 2 {{.*}} fptosi
247 %r115 = fptosi <4 x float> undef to <4 x i16>
248 ; CHECK: cost of 1 {{.*}} fptoui
249 %r116 = fptoui <4 x float> undef to <4 x i32>
250 ; CHECK: cost of 1 {{.*}} fptosi
251 %r117 = fptosi <4 x float> undef to <4 x i32>
252 ; CHECK: cost of 48 {{.*}} fptoui
253 %r118 = fptoui <4 x float> undef to <4 x i64>
254 ; CHECK: cost of 48 {{.*}} fptosi
255 %r119 = fptosi <4 x float> undef to <4 x i64>
257 ; CHECK: cost of 16 {{.*}} fptoui
258 %r120 = fptoui <4 x double> undef to <4 x i1>
259 ; CHECK: cost of 16 {{.*}} fptosi
260 %r121 = fptosi <4 x double> undef to <4 x i1>
261 ; CHECK: cost of 16 {{.*}} fptoui
262 %r122 = fptoui <4 x double> undef to <4 x i8>
263 ; CHECK: cost of 16 {{.*}} fptosi
264 %r123 = fptosi <4 x double> undef to <4 x i8>
265 ; CHECK: cost of 16 {{.*}} fptoui
266 %r124 = fptoui <4 x double> undef to <4 x i16>
267 ; CHECK: cost of 16 {{.*}} fptosi
268 %r125 = fptosi <4 x double> undef to <4 x i16>
269 ; CHECK: cost of 16 {{.*}} fptoui
270 %r126 = fptoui <4 x double> undef to <4 x i32>
271 ; CHECK: cost of 16 {{.*}} fptosi
272 %r127 = fptosi <4 x double> undef to <4 x i32>
273 ; CHECK: cost of 48 {{.*}} fptoui
274 %r128 = fptoui <4 x double> undef to <4 x i64>
275 ; CHECK: cost of 48 {{.*}} fptosi
276 %r129 = fptosi <4 x double> undef to <4 x i64>
278 ; CHECK: cost of 32 {{.*}} fptoui
279 %r130 = fptoui <8 x float> undef to <8 x i1>
280 ; CHECK: cost of 32 {{.*}} fptosi
281 %r131 = fptosi <8 x float> undef to <8 x i1>
282 ; CHECK: cost of 32 {{.*}} fptoui
283 %r132 = fptoui <8 x float> undef to <8 x i8>
284 ; CHECK: cost of 32 {{.*}} fptosi
285 %r133 = fptosi <8 x float> undef to <8 x i8>
286 ; CHECK: cost of 4 {{.*}} fptoui
287 %r134 = fptoui <8 x float> undef to <8 x i16>
288 ; CHECK: cost of 4 {{.*}} fptosi
289 %r135 = fptosi <8 x float> undef to <8 x i16>
290 ; CHECK: cost of 2 {{.*}} fptoui
291 %r136 = fptoui <8 x float> undef to <8 x i32>
292 ; CHECK: cost of 2 {{.*}} fptosi
293 %r137 = fptosi <8 x float> undef to <8 x i32>
294 ; CHECK: cost of 96 {{.*}} fptoui
295 %r138 = fptoui <8 x float> undef to <8 x i64>
296 ; CHECK: cost of 96 {{.*}} fptosi
297 %r139 = fptosi <8 x float> undef to <8 x i64>
299 ; CHECK: cost of 32 {{.*}} fptoui
300 %r140 = fptoui <8 x double> undef to <8 x i1>
301 ; CHECK: cost of 32 {{.*}} fptosi
302 %r141 = fptosi <8 x double> undef to <8 x i1>
303 ; CHECK: cost of 32 {{.*}} fptoui
304 %r142 = fptoui <8 x double> undef to <8 x i8>
305 ; CHECK: cost of 32 {{.*}} fptosi
306 %r143 = fptosi <8 x double> undef to <8 x i8>
307 ; CHECK: cost of 32 {{.*}} fptoui
308 %r144 = fptoui <8 x double> undef to <8 x i16>
309 ; CHECK: cost of 32 {{.*}} fptosi
310 %r145 = fptosi <8 x double> undef to <8 x i16>
311 ; CHECK: cost of 32 {{.*}} fptoui
312 %r146 = fptoui <8 x double> undef to <8 x i32>
313 ; CHECK: cost of 32 {{.*}} fptosi
314 %r147 = fptosi <8 x double> undef to <8 x i32>
315 ; CHECK: cost of 96 {{.*}} fptoui
316 %r148 = fptoui <8 x double> undef to <8 x i64>
317 ; CHECK: cost of 96 {{.*}} fptosi
318 %r149 = fptosi <8 x double> undef to <8 x i64>
320 ; CHECK: cost of 64 {{.*}} fptoui
321 %r150 = fptoui <16 x float> undef to <16 x i1>
322 ; CHECK: cost of 64 {{.*}} fptosi
323 %r151 = fptosi <16 x float> undef to <16 x i1>
324 ; CHECK: cost of 64 {{.*}} fptoui
325 %r152 = fptoui <16 x float> undef to <16 x i8>
326 ; CHECK: cost of 64 {{.*}} fptosi
327 %r153 = fptosi <16 x float> undef to <16 x i8>
328 ; CHECK: cost of 8 {{.*}} fptoui
329 %r154 = fptoui <16 x float> undef to <16 x i16>
330 ; CHECK: cost of 8 {{.*}} fptosi
331 %r155 = fptosi <16 x float> undef to <16 x i16>
332 ; CHECK: cost of 4 {{.*}} fptoui
333 %r156 = fptoui <16 x float> undef to <16 x i32>
334 ; CHECK: cost of 4 {{.*}} fptosi
335 %r157 = fptosi <16 x float> undef to <16 x i32>
336 ; CHECK: cost of 192 {{.*}} fptoui
337 %r158 = fptoui <16 x float> undef to <16 x i64>
338 ; CHECK: cost of 192 {{.*}} fptosi
339 %r159 = fptosi <16 x float> undef to <16 x i64>
341 ; CHECK: cost of 64 {{.*}} fptoui
342 %r160 = fptoui <16 x double> undef to <16 x i1>
343 ; CHECK: cost of 64 {{.*}} fptosi
344 %r161 = fptosi <16 x double> undef to <16 x i1>
345 ; CHECK: cost of 64 {{.*}} fptoui
346 %r162 = fptoui <16 x double> undef to <16 x i8>
347 ; CHECK: cost of 64 {{.*}} fptosi
348 %r163 = fptosi <16 x double> undef to <16 x i8>
349 ; CHECK: cost of 64 {{.*}} fptoui
350 %r164 = fptoui <16 x double> undef to <16 x i16>
351 ; CHECK: cost of 64 {{.*}} fptosi
352 %r165 = fptosi <16 x double> undef to <16 x i16>
353 ; CHECK: cost of 64 {{.*}} fptoui
354 %r166 = fptoui <16 x double> undef to <16 x i32>
355 ; CHECK: cost of 64 {{.*}} fptosi
356 %r167 = fptosi <16 x double> undef to <16 x i32>
357 ; CHECK: cost of 192 {{.*}} fptoui
358 %r168 = fptoui <16 x double> undef to <16 x i64>
359 ; CHECK: cost of 192 {{.*}} fptosi
360 %r169 = fptosi <16 x double> undef to <16 x i64>
362 ;CHECK: cost of 0 {{.*}} ret