1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-- < %s | FileCheck %s
4 define i32 @s32_f32_s24_s32(i32 %a) {
5 ; CHECK-LABEL: s32_f32_s24_s32:
7 ; CHECK-NEXT: sbfx w0, w0, #0, #24
9 %f = sitofp i32 %a to float
10 %i = fptosi float %f to i24
11 %r = sext i24 %i to i32
15 define i32 @s32_f32_u24_u32(i32 %a) {
16 ; CHECK-LABEL: s32_f32_u24_u32:
18 ; CHECK-NEXT: and w0, w0, #0xffffff
20 %f = sitofp i32 %a to float
21 %i = fptoui float %f to i24
22 %r = zext i24 %i to i32
26 define i32 @u32_f32_s24_s32(i32 %a) {
27 ; CHECK-LABEL: u32_f32_s24_s32:
29 ; CHECK-NEXT: sbfx w0, w0, #0, #24
31 %f = uitofp i32 %a to float
32 %i = fptosi float %f to i24
33 %r = sext i24 %i to i32
37 define i32 @u32_f32_u24_u32(i32 %a) {
38 ; CHECK-LABEL: u32_f32_u24_u32:
40 ; CHECK-NEXT: and w0, w0, #0xffffff
42 %f = uitofp i32 %a to float
43 %i = fptoui float %f to i24
44 %r = zext i24 %i to i32
48 ; This requires converting to FP and back.
50 define i32 @s32_f32_s25_s32(i32 %a) {
51 ; CHECK-LABEL: s32_f32_s25_s32:
53 ; CHECK-NEXT: scvtf s0, w0
54 ; CHECK-NEXT: fcvtzs w0, s0
56 %f = sitofp i32 %a to float
57 %i = fptosi float %f to i25
58 %r = sext i25 %i to i32
62 define i32 @s32_f32_u25_u32(i32 %a) {
63 ; CHECK-LABEL: s32_f32_u25_u32:
65 ; CHECK-NEXT: scvtf s0, w0
66 ; CHECK-NEXT: fcvtzs w0, s0
68 %f = sitofp i32 %a to float
69 %i = fptoui float %f to i25
70 %r = zext i25 %i to i32
74 ; TODO: This could avoid converting to FP.
76 define i32 @u32_f32_s25_s32(i32 %a) {
77 ; CHECK-LABEL: u32_f32_s25_s32:
79 ; CHECK-NEXT: ucvtf s0, w0
80 ; CHECK-NEXT: fcvtzs w0, s0
82 %f = uitofp i32 %a to float
83 %i = fptosi float %f to i25
84 %r = sext i25 %i to i32
88 define i32 @u32_f32_u25_u32(i32 %a) {
89 ; CHECK-LABEL: u32_f32_u25_u32:
91 ; CHECK-NEXT: ucvtf s0, w0
92 ; CHECK-NEXT: fcvtzs w0, s0
94 %f = uitofp i32 %a to float
95 %i = fptoui float %f to i25
96 %r = zext i25 %i to i32