xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/arm32-round-conv.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv8-linux-gnueabi -mattr=+fp-armv8 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv8-linux-gnueabihf -mattr=+fp-armv8 | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1
5*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtm.s32.f32
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test1(float %a) {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker  %call = call float @floorf(float %a) nounwind readnone
9*9880d681SAndroid Build Coastguard Worker  %conv = fptosi float %call to i32
10*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test2
14*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtm.u32.f32
15*9880d681SAndroid Build Coastguard Workerdefine i32 @test2(float %a) {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker  %call = call float @floorf(float %a) nounwind readnone
18*9880d681SAndroid Build Coastguard Worker  %conv = fptoui float %call to i32
19*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test3
23*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtm.s32.f64
24*9880d681SAndroid Build Coastguard Workerdefine i32 @test3(double %a) {
25*9880d681SAndroid Build Coastguard Workerentry:
26*9880d681SAndroid Build Coastguard Worker  %call = call double @floor(double %a) nounwind readnone
27*9880d681SAndroid Build Coastguard Worker  %conv = fptosi double %call to i32
28*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test4
32*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtm.u32.f64
33*9880d681SAndroid Build Coastguard Workerdefine i32 @test4(double %a) {
34*9880d681SAndroid Build Coastguard Workerentry:
35*9880d681SAndroid Build Coastguard Worker  %call = call double @floor(double %a) nounwind readnone
36*9880d681SAndroid Build Coastguard Worker  %conv = fptoui double %call to i32
37*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test5
41*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtp.s32.f32
42*9880d681SAndroid Build Coastguard Workerdefine i32 @test5(float %a) {
43*9880d681SAndroid Build Coastguard Workerentry:
44*9880d681SAndroid Build Coastguard Worker  %call = call float @ceilf(float %a) nounwind readnone
45*9880d681SAndroid Build Coastguard Worker  %conv = fptosi float %call to i32
46*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
47*9880d681SAndroid Build Coastguard Worker}
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test6
50*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtp.u32.f32
51*9880d681SAndroid Build Coastguard Workerdefine i32 @test6(float %a) {
52*9880d681SAndroid Build Coastguard Workerentry:
53*9880d681SAndroid Build Coastguard Worker  %call = call float @ceilf(float %a) nounwind readnone
54*9880d681SAndroid Build Coastguard Worker  %conv = fptoui float %call to i32
55*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
56*9880d681SAndroid Build Coastguard Worker}
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test7
59*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtp.s32.f64
60*9880d681SAndroid Build Coastguard Workerdefine i32 @test7(double %a) {
61*9880d681SAndroid Build Coastguard Workerentry:
62*9880d681SAndroid Build Coastguard Worker  %call = call double @ceil(double %a) nounwind readnone
63*9880d681SAndroid Build Coastguard Worker  %conv = fptosi double %call to i32
64*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test8
68*9880d681SAndroid Build Coastguard Worker; CHECK: vcvtp.u32.f64
69*9880d681SAndroid Build Coastguard Workerdefine i32 @test8(double %a) {
70*9880d681SAndroid Build Coastguard Workerentry:
71*9880d681SAndroid Build Coastguard Worker  %call = call double @ceil(double %a) nounwind readnone
72*9880d681SAndroid Build Coastguard Worker  %conv = fptoui double %call to i32
73*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test9
77*9880d681SAndroid Build Coastguard Worker; CHECK: vcvta.s32.f32
78*9880d681SAndroid Build Coastguard Workerdefine i32 @test9(float %a) {
79*9880d681SAndroid Build Coastguard Workerentry:
80*9880d681SAndroid Build Coastguard Worker  %call = call float @roundf(float %a) nounwind readnone
81*9880d681SAndroid Build Coastguard Worker  %conv = fptosi float %call to i32
82*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
83*9880d681SAndroid Build Coastguard Worker}
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test10
86*9880d681SAndroid Build Coastguard Worker; CHECK: vcvta.u32.f32
87*9880d681SAndroid Build Coastguard Workerdefine i32 @test10(float %a) {
88*9880d681SAndroid Build Coastguard Workerentry:
89*9880d681SAndroid Build Coastguard Worker  %call = call float @roundf(float %a) nounwind readnone
90*9880d681SAndroid Build Coastguard Worker  %conv = fptoui float %call to i32
91*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
92*9880d681SAndroid Build Coastguard Worker}
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test11
95*9880d681SAndroid Build Coastguard Worker; CHECK: vcvta.s32.f64
96*9880d681SAndroid Build Coastguard Workerdefine i32 @test11(double %a) {
97*9880d681SAndroid Build Coastguard Workerentry:
98*9880d681SAndroid Build Coastguard Worker  %call = call double @round(double %a) nounwind readnone
99*9880d681SAndroid Build Coastguard Worker  %conv = fptosi double %call to i32
100*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
101*9880d681SAndroid Build Coastguard Worker}
102*9880d681SAndroid Build Coastguard Worker
103*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test12
104*9880d681SAndroid Build Coastguard Worker; CHECK: vcvta.u32.f64
105*9880d681SAndroid Build Coastguard Workerdefine i32 @test12(double %a) {
106*9880d681SAndroid Build Coastguard Workerentry:
107*9880d681SAndroid Build Coastguard Worker  %call = call double @round(double %a) nounwind readnone
108*9880d681SAndroid Build Coastguard Worker  %conv = fptoui double %call to i32
109*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
110*9880d681SAndroid Build Coastguard Worker}
111*9880d681SAndroid Build Coastguard Worker
112*9880d681SAndroid Build Coastguard Workerdeclare float @floorf(float) nounwind readnone
113*9880d681SAndroid Build Coastguard Workerdeclare double @floor(double) nounwind readnone
114*9880d681SAndroid Build Coastguard Workerdeclare float @ceilf(float) nounwind readnone
115*9880d681SAndroid Build Coastguard Workerdeclare double @ceil(double) nounwind readnone
116*9880d681SAndroid Build Coastguard Workerdeclare float @roundf(float) nounwind readnone
117*9880d681SAndroid Build Coastguard Workerdeclare double @round(double) nounwind readnone
118