1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NO16
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
7 define i32 @fcvtzs_f32_i32_7(float %flt) {
8 ; CHECK-LABEL: fcvtzs_f32_i32_7:
10 ; CHECK-NEXT: fcvtzs w0, s0, #7
12 %fix = fmul float %flt, 128.0
13 %cvt = fptosi float %fix to i32
17 define i32 @fcvtzs_f32_i32_32(float %flt) {
18 ; CHECK-LABEL: fcvtzs_f32_i32_32:
20 ; CHECK-NEXT: fcvtzs w0, s0, #32
22 %fix = fmul float %flt, 4294967296.0
23 %cvt = fptosi float %fix to i32
27 define i64 @fcvtzs_f32_i64_7(float %flt) {
28 ; CHECK-LABEL: fcvtzs_f32_i64_7:
30 ; CHECK-NEXT: fcvtzs x0, s0, #7
32 %fix = fmul float %flt, 128.0
33 %cvt = fptosi float %fix to i64
37 define i64 @fcvtzs_f32_i64_64(float %flt) {
38 ; CHECK-LABEL: fcvtzs_f32_i64_64:
40 ; CHECK-NEXT: fcvtzs x0, s0, #64
42 %fix = fmul float %flt, 18446744073709551616.0
43 %cvt = fptosi float %fix to i64
47 define i32 @fcvtzs_f64_i32_7(double %dbl) {
48 ; CHECK-LABEL: fcvtzs_f64_i32_7:
50 ; CHECK-NEXT: fcvtzs w0, d0, #7
52 %fix = fmul double %dbl, 128.0
53 %cvt = fptosi double %fix to i32
57 define i32 @fcvtzs_f64_i32_32(double %dbl) {
58 ; CHECK-LABEL: fcvtzs_f64_i32_32:
60 ; CHECK-NEXT: fcvtzs w0, d0, #32
62 %fix = fmul double %dbl, 4294967296.0
63 %cvt = fptosi double %fix to i32
67 define i64 @fcvtzs_f64_i64_7(double %dbl) {
68 ; CHECK-LABEL: fcvtzs_f64_i64_7:
70 ; CHECK-NEXT: fcvtzs x0, d0, #7
72 %fix = fmul double %dbl, 128.0
73 %cvt = fptosi double %fix to i64
77 define i64 @fcvtzs_f64_i64_64(double %dbl) {
78 ; CHECK-LABEL: fcvtzs_f64_i64_64:
80 ; CHECK-NEXT: fcvtzs x0, d0, #64
82 %fix = fmul double %dbl, 18446744073709551616.0
83 %cvt = fptosi double %fix to i64
87 define i32 @fcvtzs_f16_i32_7(half %flt) {
88 ; CHECK-NO16-LABEL: fcvtzs_f16_i32_7:
89 ; CHECK-NO16: // %bb.0:
90 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
91 ; CHECK-NO16-NEXT: fcvt s0, h0
92 ; CHECK-NO16-NEXT: fmul s0, s0, s1
93 ; CHECK-NO16-NEXT: fcvt h0, s0
94 ; CHECK-NO16-NEXT: fcvt s0, h0
95 ; CHECK-NO16-NEXT: fcvtzs w0, s0
96 ; CHECK-NO16-NEXT: ret
98 ; CHECK-FP16-LABEL: fcvtzs_f16_i32_7:
99 ; CHECK-FP16: // %bb.0:
100 ; CHECK-FP16-NEXT: fcvtzs w0, h0, #7
101 ; CHECK-FP16-NEXT: ret
102 %fix = fmul half %flt, 128.0
103 %cvt = fptosi half %fix to i32
107 define i32 @fcvtzs_f16_i32_15(half %flt) {
108 ; CHECK-NO16-LABEL: fcvtzs_f16_i32_15:
109 ; CHECK-NO16: // %bb.0:
110 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
111 ; CHECK-NO16-NEXT: fcvt s0, h0
112 ; CHECK-NO16-NEXT: fmul s0, s0, s1
113 ; CHECK-NO16-NEXT: fcvt h0, s0
114 ; CHECK-NO16-NEXT: fcvt s0, h0
115 ; CHECK-NO16-NEXT: fcvtzs w0, s0
116 ; CHECK-NO16-NEXT: ret
118 ; CHECK-FP16-LABEL: fcvtzs_f16_i32_15:
119 ; CHECK-FP16: // %bb.0:
120 ; CHECK-FP16-NEXT: fcvtzs w0, h0, #15
121 ; CHECK-FP16-NEXT: ret
122 %fix = fmul half %flt, 32768.0
123 %cvt = fptosi half %fix to i32
127 define i64 @fcvtzs_f16_i64_7(half %flt) {
128 ; CHECK-NO16-LABEL: fcvtzs_f16_i64_7:
129 ; CHECK-NO16: // %bb.0:
130 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
131 ; CHECK-NO16-NEXT: fcvt s0, h0
132 ; CHECK-NO16-NEXT: fmul s0, s0, s1
133 ; CHECK-NO16-NEXT: fcvt h0, s0
134 ; CHECK-NO16-NEXT: fcvt s0, h0
135 ; CHECK-NO16-NEXT: fcvtzs x0, s0
136 ; CHECK-NO16-NEXT: ret
138 ; CHECK-FP16-LABEL: fcvtzs_f16_i64_7:
139 ; CHECK-FP16: // %bb.0:
140 ; CHECK-FP16-NEXT: fcvtzs x0, h0, #7
141 ; CHECK-FP16-NEXT: ret
142 %fix = fmul half %flt, 128.0
143 %cvt = fptosi half %fix to i64
147 define i64 @fcvtzs_f16_i64_15(half %flt) {
148 ; CHECK-NO16-LABEL: fcvtzs_f16_i64_15:
149 ; CHECK-NO16: // %bb.0:
150 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
151 ; CHECK-NO16-NEXT: fcvt s0, h0
152 ; CHECK-NO16-NEXT: fmul s0, s0, s1
153 ; CHECK-NO16-NEXT: fcvt h0, s0
154 ; CHECK-NO16-NEXT: fcvt s0, h0
155 ; CHECK-NO16-NEXT: fcvtzs x0, s0
156 ; CHECK-NO16-NEXT: ret
158 ; CHECK-FP16-LABEL: fcvtzs_f16_i64_15:
159 ; CHECK-FP16: // %bb.0:
160 ; CHECK-FP16-NEXT: fcvtzs x0, h0, #15
161 ; CHECK-FP16-NEXT: ret
162 %fix = fmul half %flt, 32768.0
163 %cvt = fptosi half %fix to i64
169 define i32 @fcvtzu_f32_i32_7(float %flt) {
170 ; CHECK-LABEL: fcvtzu_f32_i32_7:
172 ; CHECK-NEXT: fcvtzu w0, s0, #7
174 %fix = fmul float %flt, 128.0
175 %cvt = fptoui float %fix to i32
179 define i32 @fcvtzu_f32_i32_32(float %flt) {
180 ; CHECK-LABEL: fcvtzu_f32_i32_32:
182 ; CHECK-NEXT: fcvtzu w0, s0, #32
184 %fix = fmul float %flt, 4294967296.0
185 %cvt = fptoui float %fix to i32
189 define i64 @fcvtzu_f32_i64_7(float %flt) {
190 ; CHECK-LABEL: fcvtzu_f32_i64_7:
192 ; CHECK-NEXT: fcvtzu x0, s0, #7
194 %fix = fmul float %flt, 128.0
195 %cvt = fptoui float %fix to i64
199 define i64 @fcvtzu_f32_i64_64(float %flt) {
200 ; CHECK-LABEL: fcvtzu_f32_i64_64:
202 ; CHECK-NEXT: fcvtzu x0, s0, #64
204 %fix = fmul float %flt, 18446744073709551616.0
205 %cvt = fptoui float %fix to i64
209 define i32 @fcvtzu_f64_i32_7(double %dbl) {
210 ; CHECK-LABEL: fcvtzu_f64_i32_7:
212 ; CHECK-NEXT: fcvtzu w0, d0, #7
214 %fix = fmul double %dbl, 128.0
215 %cvt = fptoui double %fix to i32
219 define i32 @fcvtzu_f64_i32_32(double %dbl) {
220 ; CHECK-LABEL: fcvtzu_f64_i32_32:
222 ; CHECK-NEXT: fcvtzu w0, d0, #32
224 %fix = fmul double %dbl, 4294967296.0
225 %cvt = fptoui double %fix to i32
229 define i64 @fcvtzu_f64_i64_7(double %dbl) {
230 ; CHECK-LABEL: fcvtzu_f64_i64_7:
232 ; CHECK-NEXT: fcvtzu x0, d0, #7
234 %fix = fmul double %dbl, 128.0
235 %cvt = fptoui double %fix to i64
239 define i64 @fcvtzu_f64_i64_64(double %dbl) {
240 ; CHECK-LABEL: fcvtzu_f64_i64_64:
242 ; CHECK-NEXT: fcvtzu x0, d0, #64
244 %fix = fmul double %dbl, 18446744073709551616.0
245 %cvt = fptoui double %fix to i64
249 define i32 @fcvtzu_f16_i32_7(half %flt) {
250 ; CHECK-NO16-LABEL: fcvtzu_f16_i32_7:
251 ; CHECK-NO16: // %bb.0:
252 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
253 ; CHECK-NO16-NEXT: fcvt s0, h0
254 ; CHECK-NO16-NEXT: fmul s0, s0, s1
255 ; CHECK-NO16-NEXT: fcvt h0, s0
256 ; CHECK-NO16-NEXT: fcvt s0, h0
257 ; CHECK-NO16-NEXT: fcvtzu w0, s0
258 ; CHECK-NO16-NEXT: ret
260 ; CHECK-FP16-LABEL: fcvtzu_f16_i32_7:
261 ; CHECK-FP16: // %bb.0:
262 ; CHECK-FP16-NEXT: fcvtzu w0, h0, #7
263 ; CHECK-FP16-NEXT: ret
264 %fix = fmul half %flt, 128.0
265 %cvt = fptoui half %fix to i32
269 define i32 @fcvtzu_f16_i32_15(half %flt) {
270 ; CHECK-NO16-LABEL: fcvtzu_f16_i32_15:
271 ; CHECK-NO16: // %bb.0:
272 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
273 ; CHECK-NO16-NEXT: fcvt s0, h0
274 ; CHECK-NO16-NEXT: fmul s0, s0, s1
275 ; CHECK-NO16-NEXT: fcvt h0, s0
276 ; CHECK-NO16-NEXT: fcvt s0, h0
277 ; CHECK-NO16-NEXT: fcvtzu w0, s0
278 ; CHECK-NO16-NEXT: ret
280 ; CHECK-FP16-LABEL: fcvtzu_f16_i32_15:
281 ; CHECK-FP16: // %bb.0:
282 ; CHECK-FP16-NEXT: fcvtzu w0, h0, #15
283 ; CHECK-FP16-NEXT: ret
284 %fix = fmul half %flt, 32768.0
285 %cvt = fptoui half %fix to i32
289 define i64 @fcvtzu_f16_i64_7(half %flt) {
290 ; CHECK-NO16-LABEL: fcvtzu_f16_i64_7:
291 ; CHECK-NO16: // %bb.0:
292 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
293 ; CHECK-NO16-NEXT: fcvt s0, h0
294 ; CHECK-NO16-NEXT: fmul s0, s0, s1
295 ; CHECK-NO16-NEXT: fcvt h0, s0
296 ; CHECK-NO16-NEXT: fcvt s0, h0
297 ; CHECK-NO16-NEXT: fcvtzu x0, s0
298 ; CHECK-NO16-NEXT: ret
300 ; CHECK-FP16-LABEL: fcvtzu_f16_i64_7:
301 ; CHECK-FP16: // %bb.0:
302 ; CHECK-FP16-NEXT: fcvtzu x0, h0, #7
303 ; CHECK-FP16-NEXT: ret
304 %fix = fmul half %flt, 128.0
305 %cvt = fptoui half %fix to i64
309 define i64 @fcvtzu_f16_i64_15(half %flt) {
310 ; CHECK-NO16-LABEL: fcvtzu_f16_i64_15:
311 ; CHECK-NO16: // %bb.0:
312 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
313 ; CHECK-NO16-NEXT: fcvt s0, h0
314 ; CHECK-NO16-NEXT: fmul s0, s0, s1
315 ; CHECK-NO16-NEXT: fcvt h0, s0
316 ; CHECK-NO16-NEXT: fcvt s0, h0
317 ; CHECK-NO16-NEXT: fcvtzu x0, s0
318 ; CHECK-NO16-NEXT: ret
320 ; CHECK-FP16-LABEL: fcvtzu_f16_i64_15:
321 ; CHECK-FP16: // %bb.0:
322 ; CHECK-FP16-NEXT: fcvtzu x0, h0, #15
323 ; CHECK-FP16-NEXT: ret
324 %fix = fmul half %flt, 32768.0
325 %cvt = fptoui half %fix to i64
331 define float @scvtf_f32_i32_7(i32 %int) {
332 ; CHECK-LABEL: scvtf_f32_i32_7:
334 ; CHECK-NEXT: scvtf s0, w0, #7
336 %cvt = sitofp i32 %int to float
337 %fix = fdiv float %cvt, 128.0
341 define float @scvtf_f32_i32_32(i32 %int) {
342 ; CHECK-LABEL: scvtf_f32_i32_32:
344 ; CHECK-NEXT: scvtf s0, w0, #32
346 %cvt = sitofp i32 %int to float
347 %fix = fdiv float %cvt, 4294967296.0
351 define float @scvtf_f32_i64_7(i64 %long) {
352 ; CHECK-LABEL: scvtf_f32_i64_7:
354 ; CHECK-NEXT: scvtf s0, x0, #7
356 %cvt = sitofp i64 %long to float
357 %fix = fdiv float %cvt, 128.0
361 define float @scvtf_f32_i64_64(i64 %long) {
362 ; CHECK-LABEL: scvtf_f32_i64_64:
364 ; CHECK-NEXT: scvtf s0, x0, #64
366 %cvt = sitofp i64 %long to float
367 %fix = fdiv float %cvt, 18446744073709551616.0
371 define double @scvtf_f64_i32_7(i32 %int) {
372 ; CHECK-LABEL: scvtf_f64_i32_7:
374 ; CHECK-NEXT: scvtf d0, w0, #7
376 %cvt = sitofp i32 %int to double
377 %fix = fdiv double %cvt, 128.0
381 define double @scvtf_f64_i32_32(i32 %int) {
382 ; CHECK-LABEL: scvtf_f64_i32_32:
384 ; CHECK-NEXT: scvtf d0, w0, #32
386 %cvt = sitofp i32 %int to double
387 %fix = fdiv double %cvt, 4294967296.0
391 define double @scvtf_f64_i64_7(i64 %long) {
392 ; CHECK-LABEL: scvtf_f64_i64_7:
394 ; CHECK-NEXT: scvtf d0, x0, #7
396 %cvt = sitofp i64 %long to double
397 %fix = fdiv double %cvt, 128.0
401 define double @scvtf_f64_i64_64(i64 %long) {
402 ; CHECK-LABEL: scvtf_f64_i64_64:
404 ; CHECK-NEXT: scvtf d0, x0, #64
406 %cvt = sitofp i64 %long to double
407 %fix = fdiv double %cvt, 18446744073709551616.0
411 define half @scvtf_f16_i32_7(i32 %int) {
412 ; CHECK-NO16-LABEL: scvtf_f16_i32_7:
413 ; CHECK-NO16: // %bb.0:
414 ; CHECK-NO16-NEXT: scvtf s1, w0
415 ; CHECK-NO16-NEXT: movi v0.2s, #60, lsl #24
416 ; CHECK-NO16-NEXT: fcvt h1, s1
417 ; CHECK-NO16-NEXT: fcvt s1, h1
418 ; CHECK-NO16-NEXT: fmul s0, s1, s0
419 ; CHECK-NO16-NEXT: fcvt h0, s0
420 ; CHECK-NO16-NEXT: ret
422 ; CHECK-FP16-LABEL: scvtf_f16_i32_7:
423 ; CHECK-FP16: // %bb.0:
424 ; CHECK-FP16-NEXT: scvtf h0, w0, #7
425 ; CHECK-FP16-NEXT: ret
426 %cvt = sitofp i32 %int to half
427 %fix = fdiv half %cvt, 128.0
431 define half @scvtf_f16_i32_15(i32 %int) {
432 ; CHECK-NO16-LABEL: scvtf_f16_i32_15:
433 ; CHECK-NO16: // %bb.0:
434 ; CHECK-NO16-NEXT: scvtf s1, w0
435 ; CHECK-NO16-NEXT: movi v0.2s, #56, lsl #24
436 ; CHECK-NO16-NEXT: fcvt h1, s1
437 ; CHECK-NO16-NEXT: fcvt s1, h1
438 ; CHECK-NO16-NEXT: fmul s0, s1, s0
439 ; CHECK-NO16-NEXT: fcvt h0, s0
440 ; CHECK-NO16-NEXT: ret
442 ; CHECK-FP16-LABEL: scvtf_f16_i32_15:
443 ; CHECK-FP16: // %bb.0:
444 ; CHECK-FP16-NEXT: scvtf h0, w0, #15
445 ; CHECK-FP16-NEXT: ret
446 %cvt = sitofp i32 %int to half
447 %fix = fdiv half %cvt, 32768.0
451 define half @scvtf_f16_i64_7(i64 %long) {
452 ; CHECK-NO16-LABEL: scvtf_f16_i64_7:
453 ; CHECK-NO16: // %bb.0:
454 ; CHECK-NO16-NEXT: scvtf s1, x0
455 ; CHECK-NO16-NEXT: movi v0.2s, #60, lsl #24
456 ; CHECK-NO16-NEXT: fcvt h1, s1
457 ; CHECK-NO16-NEXT: fcvt s1, h1
458 ; CHECK-NO16-NEXT: fmul s0, s1, s0
459 ; CHECK-NO16-NEXT: fcvt h0, s0
460 ; CHECK-NO16-NEXT: ret
462 ; CHECK-FP16-LABEL: scvtf_f16_i64_7:
463 ; CHECK-FP16: // %bb.0:
464 ; CHECK-FP16-NEXT: scvtf h0, x0, #7
465 ; CHECK-FP16-NEXT: ret
466 %cvt = sitofp i64 %long to half
467 %fix = fdiv half %cvt, 128.0
471 define half @scvtf_f16_i64_15(i64 %long) {
472 ; CHECK-NO16-LABEL: scvtf_f16_i64_15:
473 ; CHECK-NO16: // %bb.0:
474 ; CHECK-NO16-NEXT: scvtf s1, x0
475 ; CHECK-NO16-NEXT: movi v0.2s, #56, lsl #24
476 ; CHECK-NO16-NEXT: fcvt h1, s1
477 ; CHECK-NO16-NEXT: fcvt s1, h1
478 ; CHECK-NO16-NEXT: fmul s0, s1, s0
479 ; CHECK-NO16-NEXT: fcvt h0, s0
480 ; CHECK-NO16-NEXT: ret
482 ; CHECK-FP16-LABEL: scvtf_f16_i64_15:
483 ; CHECK-FP16: // %bb.0:
484 ; CHECK-FP16-NEXT: scvtf h0, x0, #15
485 ; CHECK-FP16-NEXT: ret
486 %cvt = sitofp i64 %long to half
487 %fix = fdiv half %cvt, 32768.0
493 define float @ucvtf_f32_i32_7(i32 %int) {
494 ; CHECK-LABEL: ucvtf_f32_i32_7:
496 ; CHECK-NEXT: ucvtf s0, w0, #7
498 %cvt = uitofp i32 %int to float
499 %fix = fdiv float %cvt, 128.0
503 define float @ucvtf_f32_i32_32(i32 %int) {
504 ; CHECK-LABEL: ucvtf_f32_i32_32:
506 ; CHECK-NEXT: ucvtf s0, w0, #32
508 %cvt = uitofp i32 %int to float
509 %fix = fdiv float %cvt, 4294967296.0
513 define float @ucvtf_f32_i64_7(i64 %long) {
514 ; CHECK-LABEL: ucvtf_f32_i64_7:
516 ; CHECK-NEXT: ucvtf s0, x0, #7
518 %cvt = uitofp i64 %long to float
519 %fix = fdiv float %cvt, 128.0
523 define float @ucvtf_f32_i64_64(i64 %long) {
524 ; CHECK-LABEL: ucvtf_f32_i64_64:
526 ; CHECK-NEXT: ucvtf s0, x0, #64
528 %cvt = uitofp i64 %long to float
529 %fix = fdiv float %cvt, 18446744073709551616.0
533 define double @ucvtf_f64_i32_7(i32 %int) {
534 ; CHECK-LABEL: ucvtf_f64_i32_7:
536 ; CHECK-NEXT: ucvtf d0, w0, #7
538 %cvt = uitofp i32 %int to double
539 %fix = fdiv double %cvt, 128.0
543 define double @ucvtf_f64_i32_32(i32 %int) {
544 ; CHECK-LABEL: ucvtf_f64_i32_32:
546 ; CHECK-NEXT: ucvtf d0, w0, #32
548 %cvt = uitofp i32 %int to double
549 %fix = fdiv double %cvt, 4294967296.0
553 define double @ucvtf_f64_i64_7(i64 %long) {
554 ; CHECK-LABEL: ucvtf_f64_i64_7:
556 ; CHECK-NEXT: ucvtf d0, x0, #7
558 %cvt = uitofp i64 %long to double
559 %fix = fdiv double %cvt, 128.0
563 define double @ucvtf_f64_i64_64(i64 %long) {
564 ; CHECK-LABEL: ucvtf_f64_i64_64:
566 ; CHECK-NEXT: ucvtf d0, x0, #64
568 %cvt = uitofp i64 %long to double
569 %fix = fdiv double %cvt, 18446744073709551616.0
573 define half @ucvtf_f16_i32_7(i32 %int) {
574 ; CHECK-NO16-LABEL: ucvtf_f16_i32_7:
575 ; CHECK-NO16: // %bb.0:
576 ; CHECK-NO16-NEXT: ucvtf s1, w0
577 ; CHECK-NO16-NEXT: movi v0.2s, #60, lsl #24
578 ; CHECK-NO16-NEXT: fcvt h1, s1
579 ; CHECK-NO16-NEXT: fcvt s1, h1
580 ; CHECK-NO16-NEXT: fmul s0, s1, s0
581 ; CHECK-NO16-NEXT: fcvt h0, s0
582 ; CHECK-NO16-NEXT: ret
584 ; CHECK-FP16-LABEL: ucvtf_f16_i32_7:
585 ; CHECK-FP16: // %bb.0:
586 ; CHECK-FP16-NEXT: ucvtf h0, w0, #7
587 ; CHECK-FP16-NEXT: ret
588 %cvt = uitofp i32 %int to half
589 %fix = fdiv half %cvt, 128.0
593 define half @ucvtf_f16_i32_15(i32 %int) {
594 ; CHECK-NO16-LABEL: ucvtf_f16_i32_15:
595 ; CHECK-NO16: // %bb.0:
596 ; CHECK-NO16-NEXT: ucvtf s1, w0
597 ; CHECK-NO16-NEXT: movi v0.2s, #56, lsl #24
598 ; CHECK-NO16-NEXT: fcvt h1, s1
599 ; CHECK-NO16-NEXT: fcvt s1, h1
600 ; CHECK-NO16-NEXT: fmul s0, s1, s0
601 ; CHECK-NO16-NEXT: fcvt h0, s0
602 ; CHECK-NO16-NEXT: ret
604 ; CHECK-FP16-LABEL: ucvtf_f16_i32_15:
605 ; CHECK-FP16: // %bb.0:
606 ; CHECK-FP16-NEXT: ucvtf h0, w0, #15
607 ; CHECK-FP16-NEXT: ret
608 %cvt = uitofp i32 %int to half
609 %fix = fdiv half %cvt, 32768.0
613 define half @ucvtf_f16_i64_7(i64 %long) {
614 ; CHECK-NO16-LABEL: ucvtf_f16_i64_7:
615 ; CHECK-NO16: // %bb.0:
616 ; CHECK-NO16-NEXT: ucvtf s1, x0
617 ; CHECK-NO16-NEXT: movi v0.2s, #60, lsl #24
618 ; CHECK-NO16-NEXT: fcvt h1, s1
619 ; CHECK-NO16-NEXT: fcvt s1, h1
620 ; CHECK-NO16-NEXT: fmul s0, s1, s0
621 ; CHECK-NO16-NEXT: fcvt h0, s0
622 ; CHECK-NO16-NEXT: ret
624 ; CHECK-FP16-LABEL: ucvtf_f16_i64_7:
625 ; CHECK-FP16: // %bb.0:
626 ; CHECK-FP16-NEXT: ucvtf h0, x0, #7
627 ; CHECK-FP16-NEXT: ret
628 %cvt = uitofp i64 %long to half
629 %fix = fdiv half %cvt, 128.0
633 define half @ucvtf_f16_i64_15(i64 %long) {
634 ; CHECK-NO16-LABEL: ucvtf_f16_i64_15:
635 ; CHECK-NO16: // %bb.0:
636 ; CHECK-NO16-NEXT: ucvtf s1, x0
637 ; CHECK-NO16-NEXT: movi v0.2s, #56, lsl #24
638 ; CHECK-NO16-NEXT: fcvt h1, s1
639 ; CHECK-NO16-NEXT: fcvt s1, h1
640 ; CHECK-NO16-NEXT: fmul s0, s1, s0
641 ; CHECK-NO16-NEXT: fcvt h0, s0
642 ; CHECK-NO16-NEXT: ret
644 ; CHECK-FP16-LABEL: ucvtf_f16_i64_15:
645 ; CHECK-FP16: // %bb.0:
646 ; CHECK-FP16-NEXT: ucvtf h0, x0, #15
647 ; CHECK-FP16-NEXT: ret
648 %cvt = uitofp i64 %long to half
649 %fix = fdiv half %cvt, 32768.0
656 declare i32 @llvm.fptosi.sat.i32.f32(float)
657 declare i64 @llvm.fptosi.sat.i64.f32(float)
658 declare i32 @llvm.fptosi.sat.i32.f64(double)
659 declare i64 @llvm.fptosi.sat.i64.f64(double)
660 declare i32 @llvm.fptosi.sat.i32.f16(half)
661 declare i64 @llvm.fptosi.sat.i64.f16(half)
663 define i32 @fcvtzs_sat_f32_i32_7(float %flt) {
664 ; CHECK-LABEL: fcvtzs_sat_f32_i32_7:
666 ; CHECK-NEXT: fcvtzs w0, s0, #7
668 %fix = fmul float %flt, 128.0
669 %cvt = call i32 @llvm.fptosi.sat.i32.f32(float %fix)
673 define i32 @fcvtzs_sat_f32_i32_32(float %flt) {
674 ; CHECK-LABEL: fcvtzs_sat_f32_i32_32:
676 ; CHECK-NEXT: fcvtzs w0, s0, #32
678 %fix = fmul float %flt, 4294967296.0
679 %cvt = call i32 @llvm.fptosi.sat.i32.f32(float %fix)
683 define i64 @fcvtzs_sat_f32_i64_64(float %flt) {
684 ; CHECK-LABEL: fcvtzs_sat_f32_i64_64:
686 ; CHECK-NEXT: fcvtzs x0, s0, #64
688 %fix = fmul float %flt, 18446744073709551616.0
689 %cvt = call i64 @llvm.fptosi.sat.i64.f32(float %fix)
693 define i32 @fcvtzs_sat_f64_i32_7(double %dbl) {
694 ; CHECK-LABEL: fcvtzs_sat_f64_i32_7:
696 ; CHECK-NEXT: fcvtzs w0, d0, #7
698 %fix = fmul double %dbl, 128.0
699 %cvt = call i32 @llvm.fptosi.sat.i32.f64(double %fix)
703 define i32 @fcvtzs_sat_f64_i32_32(double %dbl) {
704 ; CHECK-LABEL: fcvtzs_sat_f64_i32_32:
706 ; CHECK-NEXT: fcvtzs w0, d0, #32
708 %fix = fmul double %dbl, 4294967296.0
709 %cvt = call i32 @llvm.fptosi.sat.i32.f64(double %fix)
713 define i64 @fcvtzs_sat_f64_i64_7(double %dbl) {
714 ; CHECK-LABEL: fcvtzs_sat_f64_i64_7:
716 ; CHECK-NEXT: fcvtzs x0, d0, #7
718 %fix = fmul double %dbl, 128.0
719 %cvt = call i64 @llvm.fptosi.sat.i64.f64(double %fix)
723 define i64 @fcvtzs_sat_f64_i64_64(double %dbl) {
724 ; CHECK-LABEL: fcvtzs_sat_f64_i64_64:
726 ; CHECK-NEXT: fcvtzs x0, d0, #64
728 %fix = fmul double %dbl, 18446744073709551616.0
729 %cvt = call i64 @llvm.fptosi.sat.i64.f64(double %fix)
733 define i32 @fcvtzs_sat_f16_i32_7(half %dbl) {
734 ; CHECK-NO16-LABEL: fcvtzs_sat_f16_i32_7:
735 ; CHECK-NO16: // %bb.0:
736 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
737 ; CHECK-NO16-NEXT: fcvt s0, h0
738 ; CHECK-NO16-NEXT: fmul s0, s0, s1
739 ; CHECK-NO16-NEXT: fcvt h0, s0
740 ; CHECK-NO16-NEXT: fcvt s0, h0
741 ; CHECK-NO16-NEXT: fcvtzs w0, s0
742 ; CHECK-NO16-NEXT: ret
744 ; CHECK-FP16-LABEL: fcvtzs_sat_f16_i32_7:
745 ; CHECK-FP16: // %bb.0:
746 ; CHECK-FP16-NEXT: fcvtzs w0, h0, #7
747 ; CHECK-FP16-NEXT: ret
748 %fix = fmul half %dbl, 128.0
749 %cvt = call i32 @llvm.fptosi.sat.i32.f16(half %fix)
753 define i32 @fcvtzs_sat_f16_i32_15(half %dbl) {
754 ; CHECK-NO16-LABEL: fcvtzs_sat_f16_i32_15:
755 ; CHECK-NO16: // %bb.0:
756 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
757 ; CHECK-NO16-NEXT: fcvt s0, h0
758 ; CHECK-NO16-NEXT: fmul s0, s0, s1
759 ; CHECK-NO16-NEXT: fcvt h0, s0
760 ; CHECK-NO16-NEXT: fcvt s0, h0
761 ; CHECK-NO16-NEXT: fcvtzs w0, s0
762 ; CHECK-NO16-NEXT: ret
764 ; CHECK-FP16-LABEL: fcvtzs_sat_f16_i32_15:
765 ; CHECK-FP16: // %bb.0:
766 ; CHECK-FP16-NEXT: fcvtzs w0, h0, #15
767 ; CHECK-FP16-NEXT: ret
768 %fix = fmul half %dbl, 32768.0
769 %cvt = call i32 @llvm.fptosi.sat.i32.f16(half %fix)
773 define i64 @fcvtzs_sat_f16_i64_7(half %dbl) {
774 ; CHECK-NO16-LABEL: fcvtzs_sat_f16_i64_7:
775 ; CHECK-NO16: // %bb.0:
776 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
777 ; CHECK-NO16-NEXT: fcvt s0, h0
778 ; CHECK-NO16-NEXT: fmul s0, s0, s1
779 ; CHECK-NO16-NEXT: fcvt h0, s0
780 ; CHECK-NO16-NEXT: fcvt s0, h0
781 ; CHECK-NO16-NEXT: fcvtzs x0, s0
782 ; CHECK-NO16-NEXT: ret
784 ; CHECK-FP16-LABEL: fcvtzs_sat_f16_i64_7:
785 ; CHECK-FP16: // %bb.0:
786 ; CHECK-FP16-NEXT: fcvtzs x0, h0, #7
787 ; CHECK-FP16-NEXT: ret
788 %fix = fmul half %dbl, 128.0
789 %cvt = call i64 @llvm.fptosi.sat.i64.f16(half %fix)
793 define i64 @fcvtzs_sat_f16_i64_15(half %dbl) {
794 ; CHECK-NO16-LABEL: fcvtzs_sat_f16_i64_15:
795 ; CHECK-NO16: // %bb.0:
796 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
797 ; CHECK-NO16-NEXT: fcvt s0, h0
798 ; CHECK-NO16-NEXT: fmul s0, s0, s1
799 ; CHECK-NO16-NEXT: fcvt h0, s0
800 ; CHECK-NO16-NEXT: fcvt s0, h0
801 ; CHECK-NO16-NEXT: fcvtzs x0, s0
802 ; CHECK-NO16-NEXT: ret
804 ; CHECK-FP16-LABEL: fcvtzs_sat_f16_i64_15:
805 ; CHECK-FP16: // %bb.0:
806 ; CHECK-FP16-NEXT: fcvtzs x0, h0, #15
807 ; CHECK-FP16-NEXT: ret
808 %fix = fmul half %dbl, 32768.0
809 %cvt = call i64 @llvm.fptosi.sat.i64.f16(half %fix)
815 declare i32 @llvm.fptoui.sat.i32.f32(float)
816 declare i64 @llvm.fptoui.sat.i64.f32(float)
817 declare i32 @llvm.fptoui.sat.i32.f64(double)
818 declare i64 @llvm.fptoui.sat.i64.f64(double)
819 declare i32 @llvm.fptoui.sat.i32.f16(half)
820 declare i64 @llvm.fptoui.sat.i64.f16(half)
822 define i32 @fcvtzu_sat_f32_i32_7(float %flt) {
823 ; CHECK-LABEL: fcvtzu_sat_f32_i32_7:
825 ; CHECK-NEXT: fcvtzu w0, s0, #7
827 %fix = fmul float %flt, 128.0
828 %cvt = call i32 @llvm.fptoui.sat.i32.f32(float %fix)
832 define i32 @fcvtzu_sat_f32_i32_32(float %flt) {
833 ; CHECK-LABEL: fcvtzu_sat_f32_i32_32:
835 ; CHECK-NEXT: fcvtzu w0, s0, #32
837 %fix = fmul float %flt, 4294967296.0
838 %cvt = call i32 @llvm.fptoui.sat.i32.f32(float %fix)
842 define i64 @fcvtzu_sat_f32_i64_64(float %flt) {
843 ; CHECK-LABEL: fcvtzu_sat_f32_i64_64:
845 ; CHECK-NEXT: fcvtzu x0, s0, #64
847 %fix = fmul float %flt, 18446744073709551616.0
848 %cvt = call i64 @llvm.fptoui.sat.i64.f32(float %fix)
852 define i32 @fcvtzu_sat_f64_i32_7(double %dbl) {
853 ; CHECK-LABEL: fcvtzu_sat_f64_i32_7:
855 ; CHECK-NEXT: fcvtzu w0, d0, #7
857 %fix = fmul double %dbl, 128.0
858 %cvt = call i32 @llvm.fptoui.sat.i32.f64(double %fix)
862 define i32 @fcvtzu_sat_f64_i32_32(double %dbl) {
863 ; CHECK-LABEL: fcvtzu_sat_f64_i32_32:
865 ; CHECK-NEXT: fcvtzu w0, d0, #32
867 %fix = fmul double %dbl, 4294967296.0
868 %cvt = call i32 @llvm.fptoui.sat.i32.f64(double %fix)
872 define i64 @fcvtzu_sat_f64_i64_7(double %dbl) {
873 ; CHECK-LABEL: fcvtzu_sat_f64_i64_7:
875 ; CHECK-NEXT: fcvtzu x0, d0, #7
877 %fix = fmul double %dbl, 128.0
878 %cvt = call i64 @llvm.fptoui.sat.i64.f64(double %fix)
882 define i64 @fcvtzu_sat_f64_i64_64(double %dbl) {
883 ; CHECK-LABEL: fcvtzu_sat_f64_i64_64:
885 ; CHECK-NEXT: fcvtzu x0, d0, #64
887 %fix = fmul double %dbl, 18446744073709551616.0
888 %cvt = call i64 @llvm.fptoui.sat.i64.f64(double %fix)
892 define i32 @fcvtzu_sat_f16_i32_7(half %dbl) {
893 ; CHECK-NO16-LABEL: fcvtzu_sat_f16_i32_7:
894 ; CHECK-NO16: // %bb.0:
895 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
896 ; CHECK-NO16-NEXT: fcvt s0, h0
897 ; CHECK-NO16-NEXT: fmul s0, s0, s1
898 ; CHECK-NO16-NEXT: fcvt h0, s0
899 ; CHECK-NO16-NEXT: fcvt s0, h0
900 ; CHECK-NO16-NEXT: fcvtzu w0, s0
901 ; CHECK-NO16-NEXT: ret
903 ; CHECK-FP16-LABEL: fcvtzu_sat_f16_i32_7:
904 ; CHECK-FP16: // %bb.0:
905 ; CHECK-FP16-NEXT: fcvtzu w0, h0, #7
906 ; CHECK-FP16-NEXT: ret
907 %fix = fmul half %dbl, 128.0
908 %cvt = call i32 @llvm.fptoui.sat.i32.f16(half %fix)
912 define i32 @fcvtzu_sat_f16_i32_15(half %dbl) {
913 ; CHECK-NO16-LABEL: fcvtzu_sat_f16_i32_15:
914 ; CHECK-NO16: // %bb.0:
915 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
916 ; CHECK-NO16-NEXT: fcvt s0, h0
917 ; CHECK-NO16-NEXT: fmul s0, s0, s1
918 ; CHECK-NO16-NEXT: fcvt h0, s0
919 ; CHECK-NO16-NEXT: fcvt s0, h0
920 ; CHECK-NO16-NEXT: fcvtzu w0, s0
921 ; CHECK-NO16-NEXT: ret
923 ; CHECK-FP16-LABEL: fcvtzu_sat_f16_i32_15:
924 ; CHECK-FP16: // %bb.0:
925 ; CHECK-FP16-NEXT: fcvtzu w0, h0, #15
926 ; CHECK-FP16-NEXT: ret
927 %fix = fmul half %dbl, 32768.0
928 %cvt = call i32 @llvm.fptoui.sat.i32.f16(half %fix)
932 define i64 @fcvtzu_sat_f16_i64_7(half %dbl) {
933 ; CHECK-NO16-LABEL: fcvtzu_sat_f16_i64_7:
934 ; CHECK-NO16: // %bb.0:
935 ; CHECK-NO16-NEXT: movi v1.2s, #67, lsl #24
936 ; CHECK-NO16-NEXT: fcvt s0, h0
937 ; CHECK-NO16-NEXT: fmul s0, s0, s1
938 ; CHECK-NO16-NEXT: fcvt h0, s0
939 ; CHECK-NO16-NEXT: fcvt s0, h0
940 ; CHECK-NO16-NEXT: fcvtzu x0, s0
941 ; CHECK-NO16-NEXT: ret
943 ; CHECK-FP16-LABEL: fcvtzu_sat_f16_i64_7:
944 ; CHECK-FP16: // %bb.0:
945 ; CHECK-FP16-NEXT: fcvtzu x0, h0, #7
946 ; CHECK-FP16-NEXT: ret
947 %fix = fmul half %dbl, 128.0
948 %cvt = call i64 @llvm.fptoui.sat.i64.f16(half %fix)
952 define i64 @fcvtzu_sat_f16_i64_15(half %dbl) {
953 ; CHECK-NO16-LABEL: fcvtzu_sat_f16_i64_15:
954 ; CHECK-NO16: // %bb.0:
955 ; CHECK-NO16-NEXT: movi v1.2s, #71, lsl #24
956 ; CHECK-NO16-NEXT: fcvt s0, h0
957 ; CHECK-NO16-NEXT: fmul s0, s0, s1
958 ; CHECK-NO16-NEXT: fcvt h0, s0
959 ; CHECK-NO16-NEXT: fcvt s0, h0
960 ; CHECK-NO16-NEXT: fcvtzu x0, s0
961 ; CHECK-NO16-NEXT: ret
963 ; CHECK-FP16-LABEL: fcvtzu_sat_f16_i64_15:
964 ; CHECK-FP16: // %bb.0:
965 ; CHECK-FP16-NEXT: fcvtzu x0, h0, #15
966 ; CHECK-FP16-NEXT: ret
967 %fix = fmul half %dbl, 32768.0
968 %cvt = call i64 @llvm.fptoui.sat.i64.f16(half %fix)