1 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s --check-prefix=CHECK-INEXACT
2 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -enable-unsafe-fp-math | FileCheck %s --check-prefix=CHECK-FAST
3 ; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefix=CHECK-FAST
5 ; CHECK-INEXACT-LABEL: testmsws:
6 ; CHECK-INEXACT: fcvtms w0, s0
7 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
9 ; CHECK-FAST-LABEL: testmsws:
10 ; CHECK-FAST: fcvtms w0, s0
11 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
12 define i32 @testmsws(float %a) {
14 %call = call float @floorf(float %a) nounwind readnone
15 %conv = fptosi float %call to i32
19 ; CHECK-INEXACT-LABEL: testmsxs:
20 ; CHECK-INEXACT: fcvtms x0, s0
21 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
23 ; CHECK-FAST-LABEL: testmsxs:
24 ; CHECK-FAST: fcvtms x0, s0
25 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
26 define i64 @testmsxs(float %a) {
28 %call = call float @floorf(float %a) nounwind readnone
29 %conv = fptosi float %call to i64
33 ; CHECK-INEXACT-LABEL: testmswd:
34 ; CHECK-INEXACT: fcvtms w0, d0
35 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
37 ; CHECK-FAST-LABEL: testmswd:
38 ; CHECK-FAST: fcvtms w0, d0
39 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
40 define i32 @testmswd(double %a) {
42 %call = call double @floor(double %a) nounwind readnone
43 %conv = fptosi double %call to i32
47 ; CHECK-INEXACT-LABEL: testmsxd:
48 ; CHECK-INEXACT: fcvtms x0, d0
49 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
51 ; CHECK-FAST-LABEL: testmsxd:
52 ; CHECK-FAST: fcvtms x0, d0
53 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
54 define i64 @testmsxd(double %a) {
56 %call = call double @floor(double %a) nounwind readnone
57 %conv = fptosi double %call to i64
61 ; CHECK-INEXACT-LABEL: testmuws:
62 ; CHECK-INEXACT: fcvtmu w0, s0
63 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
65 ; CHECK-FAST-LABEL: testmuws:
66 ; CHECK-FAST: fcvtmu w0, s0
67 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
68 define i32 @testmuws(float %a) {
70 %call = call float @floorf(float %a) nounwind readnone
71 %conv = fptoui float %call to i32
75 ; CHECK-INEXACT-LABEL: testmuxs:
76 ; CHECK-INEXACT: fcvtmu x0, s0
77 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
79 ; CHECK-FAST-LABEL: testmuxs:
80 ; CHECK-FAST: fcvtmu x0, s0
81 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
82 define i64 @testmuxs(float %a) {
84 %call = call float @floorf(float %a) nounwind readnone
85 %conv = fptoui float %call to i64
89 ; CHECK-INEXACT-LABEL: testmuwd:
90 ; CHECK-INEXACT: fcvtmu w0, d0
91 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
93 ; CHECK-FAST-LABEL: testmuwd:
94 ; CHECK-FAST: fcvtmu w0, d0
95 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
96 define i32 @testmuwd(double %a) {
98 %call = call double @floor(double %a) nounwind readnone
99 %conv = fptoui double %call to i32
103 ; CHECK-INEXACT-LABEL: testmuxd:
104 ; CHECK-INEXACT: fcvtmu x0, d0
105 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
107 ; CHECK-FAST-LABEL: testmuxd:
108 ; CHECK-FAST: fcvtmu x0, d0
109 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
110 define i64 @testmuxd(double %a) {
112 %call = call double @floor(double %a) nounwind readnone
113 %conv = fptoui double %call to i64
117 ; CHECK-INEXACT-LABEL: testpsws:
118 ; CHECK-INEXACT: fcvtps w0, s0
119 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
121 ; CHECK-FAST-LABEL: testpsws:
122 ; CHECK-FAST: fcvtps w0, s0
123 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
124 define i32 @testpsws(float %a) {
126 %call = call float @ceilf(float %a) nounwind readnone
127 %conv = fptosi float %call to i32
131 ; CHECK-INEXACT-LABEL: testpsxs:
132 ; CHECK-INEXACT: fcvtps x0, s0
133 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
135 ; CHECK-FAST-LABEL: testpsxs:
136 ; CHECK-FAST: fcvtps x0, s0
137 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
138 define i64 @testpsxs(float %a) {
140 %call = call float @ceilf(float %a) nounwind readnone
141 %conv = fptosi float %call to i64
145 ; CHECK-INEXACT-LABEL: testpswd:
146 ; CHECK-INEXACT: fcvtps w0, d0
147 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
149 ; CHECK-FAST-LABEL: testpswd:
150 ; CHECK-FAST: fcvtps w0, d0
151 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
152 define i32 @testpswd(double %a) {
154 %call = call double @ceil(double %a) nounwind readnone
155 %conv = fptosi double %call to i32
159 ; CHECK-INEXACT-LABEL: testpsxd:
160 ; CHECK-INEXACT: fcvtps x0, d0
161 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
163 ; CHECK-FAST-LABEL: testpsxd:
164 ; CHECK-FAST: fcvtps x0, d0
165 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
166 define i64 @testpsxd(double %a) {
168 %call = call double @ceil(double %a) nounwind readnone
169 %conv = fptosi double %call to i64
173 ; CHECK-INEXACT-LABEL: testpuws:
174 ; CHECK-INEXACT: fcvtpu w0, s0
175 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
177 ; CHECK-FAST-LABEL: testpuws:
178 ; CHECK-FAST: fcvtpu w0, s0
179 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
180 define i32 @testpuws(float %a) {
182 %call = call float @ceilf(float %a) nounwind readnone
183 %conv = fptoui float %call to i32
187 ; CHECK-INEXACT-LABEL: testpuxs:
188 ; CHECK-INEXACT: fcvtpu x0, s0
189 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
191 ; CHECK-FAST-LABEL: testpuxs:
192 ; CHECK-FAST: fcvtpu x0, s0
193 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
194 define i64 @testpuxs(float %a) {
196 %call = call float @ceilf(float %a) nounwind readnone
197 %conv = fptoui float %call to i64
201 ; CHECK-INEXACT-LABEL: testpuwd:
202 ; CHECK-INEXACT: fcvtpu w0, d0
203 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
205 ; CHECK-FAST-LABEL: testpuwd:
206 ; CHECK-FAST: fcvtpu w0, d0
207 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
208 define i32 @testpuwd(double %a) {
210 %call = call double @ceil(double %a) nounwind readnone
211 %conv = fptoui double %call to i32
215 ; CHECK-INEXACT-LABEL: testpuxd:
216 ; CHECK-INEXACT: fcvtpu x0, d0
217 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
219 ; CHECK-FAST-LABEL: testpuxd:
220 ; CHECK-FAST: fcvtpu x0, d0
221 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
222 define i64 @testpuxd(double %a) {
224 %call = call double @ceil(double %a) nounwind readnone
225 %conv = fptoui double %call to i64
229 ; CHECK-INEXACT-LABEL: testzsws:
230 ; CHECK-INEXACT: fcvtzs w0, s0
231 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
233 ; CHECK-FAST-LABEL: testzsws:
234 ; CHECK-FAST: fcvtzs w0, s0
235 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
236 define i32 @testzsws(float %a) {
238 %call = call float @truncf(float %a) nounwind readnone
239 %conv = fptosi float %call to i32
243 ; CHECK-INEXACT-LABEL: testzsxs:
244 ; CHECK-INEXACT: fcvtzs x0, s0
245 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
247 ; CHECK-FAST-LABEL: testzsxs:
248 ; CHECK-FAST: fcvtzs x0, s0
249 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
250 define i64 @testzsxs(float %a) {
252 %call = call float @truncf(float %a) nounwind readnone
253 %conv = fptosi float %call to i64
257 ; CHECK-INEXACT-LABEL: testzswd:
258 ; CHECK-INEXACT: fcvtzs w0, d0
259 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
261 ; CHECK-FAST-LABEL: testzswd:
262 ; CHECK-FAST: fcvtzs w0, d0
263 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
264 define i32 @testzswd(double %a) {
266 %call = call double @trunc(double %a) nounwind readnone
267 %conv = fptosi double %call to i32
271 ; CHECK-INEXACT-LABEL: testzsxd:
272 ; CHECK-INEXACT: fcvtzs x0, d0
273 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
275 ; CHECK-FAST-LABEL: testzsxd:
276 ; CHECK-FAST: fcvtzs x0, d0
277 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
278 define i64 @testzsxd(double %a) {
280 %call = call double @trunc(double %a) nounwind readnone
281 %conv = fptosi double %call to i64
285 ; CHECK-INEXACT-LABEL: testzuws:
286 ; CHECK-INEXACT: fcvtzu w0, s0
287 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
289 ; CHECK-FAST-LABEL: testzuws:
290 ; CHECK-FAST: fcvtzu w0, s0
291 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
292 define i32 @testzuws(float %a) {
294 %call = call float @truncf(float %a) nounwind readnone
295 %conv = fptoui float %call to i32
299 ; CHECK-INEXACT-LABEL: testzuxs:
300 ; CHECK-INEXACT: fcvtzu x0, s0
301 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
303 ; CHECK-FAST-LABEL: testzuxs:
304 ; CHECK-FAST: fcvtzu x0, s0
305 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
306 define i64 @testzuxs(float %a) {
308 %call = call float @truncf(float %a) nounwind readnone
309 %conv = fptoui float %call to i64
313 ; CHECK-INEXACT-LABEL: testzuwd:
314 ; CHECK-INEXACT: fcvtzu w0, d0
315 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
317 ; CHECK-FAST-LABEL: testzuwd:
318 ; CHECK-FAST: fcvtzu w0, d0
319 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
320 define i32 @testzuwd(double %a) {
322 %call = call double @trunc(double %a) nounwind readnone
323 %conv = fptoui double %call to i32
327 ; CHECK-INEXACT-LABEL: testzuxd:
328 ; CHECK-INEXACT: fcvtzu x0, d0
329 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
331 ; CHECK-FAST-LABEL: testzuxd:
332 ; CHECK-FAST: fcvtzu x0, d0
333 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
334 define i64 @testzuxd(double %a) {
336 %call = call double @trunc(double %a) nounwind readnone
337 %conv = fptoui double %call to i64
341 ; CHECK-INEXACT-LABEL: testasws:
342 ; CHECK-INEXACT: fcvtas w0, s0
343 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
345 ; CHECK-FAST-LABEL: testasws:
346 ; CHECK-FAST: fcvtas w0, s0
347 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
348 define i32 @testasws(float %a) {
350 %call = call float @roundf(float %a) nounwind readnone
351 %conv = fptosi float %call to i32
355 ; CHECK-INEXACT-LABEL: testasxs:
356 ; CHECK-INEXACT: fcvtas x0, s0
357 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
359 ; CHECK-FAST-LABEL: testasxs:
360 ; CHECK-FAST: fcvtas x0, s0
361 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
362 define i64 @testasxs(float %a) {
364 %call = call float @roundf(float %a) nounwind readnone
365 %conv = fptosi float %call to i64
369 ; CHECK-INEXACT-LABEL: testaswd:
370 ; CHECK-INEXACT: fcvtas w0, d0
371 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
373 ; CHECK-FAST-LABEL: testaswd:
374 ; CHECK-FAST: fcvtas w0, d0
375 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
376 define i32 @testaswd(double %a) {
378 %call = call double @round(double %a) nounwind readnone
379 %conv = fptosi double %call to i32
383 ; CHECK-INEXACT-LABEL: testasxd:
384 ; CHECK-INEXACT: fcvtas x0, d0
385 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
387 ; CHECK-FAST-LABEL: testasxd:
388 ; CHECK-FAST: fcvtas x0, d0
389 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
390 define i64 @testasxd(double %a) {
392 %call = call double @round(double %a) nounwind readnone
393 %conv = fptosi double %call to i64
397 ; CHECK-INEXACT-LABEL: testauws:
398 ; CHECK-INEXACT: fcvtau w0, s0
399 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
401 ; CHECK-FAST-LABEL: testauws:
402 ; CHECK-FAST: fcvtau w0, s0
403 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
404 define i32 @testauws(float %a) {
406 %call = call float @roundf(float %a) nounwind readnone
407 %conv = fptoui float %call to i32
411 ; CHECK-INEXACT-LABEL: testauxs:
412 ; CHECK-INEXACT: fcvtau x0, s0
413 ; CHECK-INEXACT: frintx {{s[0-9]+}}, s0
415 ; CHECK-FAST-LABEL: testauxs:
416 ; CHECK-FAST: fcvtau x0, s0
417 ; CHECK-FAST-NOT: frintx {{s[0-9]+}}, s0
418 define i64 @testauxs(float %a) {
420 %call = call float @roundf(float %a) nounwind readnone
421 %conv = fptoui float %call to i64
425 ; CHECK-INEXACT-LABEL: testauwd:
426 ; CHECK-INEXACT: fcvtau w0, d0
427 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
429 ; CHECK-FAST-LABEL: testauwd:
430 ; CHECK-FAST: fcvtau w0, d0
431 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
432 define i32 @testauwd(double %a) {
434 %call = call double @round(double %a) nounwind readnone
435 %conv = fptoui double %call to i32
439 ; CHECK-INEXACT-LABEL: testauxd:
440 ; CHECK-INEXACT: fcvtau x0, d0
441 ; CHECK-INEXACT: frintx {{d[0-9]+}}, d0
443 ; CHECK-FAST-LABEL: testauxd:
444 ; CHECK-FAST: fcvtau x0, d0
445 ; CHECK-FAST-NOT: frintx {{d[0-9]+}}, d0
446 define i64 @testauxd(double %a) {
448 %call = call double @round(double %a) nounwind readnone
449 %conv = fptoui double %call to i64
454 declare float @floorf(float) nounwind readnone
455 declare double @floor(double) nounwind readnone
456 declare float @ceilf(float) nounwind readnone
457 declare double @ceil(double) nounwind readnone
458 declare float @truncf(float) nounwind readnone
459 declare double @trunc(double) nounwind readnone
460 declare float @roundf(float) nounwind readnone
461 declare double @round(double) nounwind readnone