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