1; RUN: llc -O3 < %s -mtriple=arm64 | FileCheck %s
2
3; CHECK-LABEL: test1:
4; CHECK: frintm
5; CHECK-NOT: frintx
6define float @test1(float %a) #0 {
7entry:
8  %call = tail call float @floorf(float %a) nounwind readnone
9  ret float %call
10}
11
12declare float @floorf(float) nounwind readnone
13
14; CHECK-LABEL: test2:
15; CHECK: frintm
16; CHECK-NOT: frintx
17define double @test2(double %a) #0 {
18entry:
19  %call = tail call double @floor(double %a) nounwind readnone
20  ret double %call
21}
22
23declare double @floor(double) nounwind readnone
24
25; CHECK-LABEL: test3:
26; CHECK: frinti
27define float @test3(float %a) #0 {
28entry:
29  %call = tail call float @nearbyintf(float %a) nounwind readnone
30  ret float %call
31}
32
33declare float @nearbyintf(float) nounwind readnone
34
35; CHECK-LABEL: test4:
36; CHECK: frinti
37define double @test4(double %a) #0 {
38entry:
39  %call = tail call double @nearbyint(double %a) nounwind readnone
40  ret double %call
41}
42
43declare double @nearbyint(double) nounwind readnone
44
45; CHECK-LABEL: test5:
46; CHECK: frintp
47; CHECK-NOT: frintx
48define float @test5(float %a) #0 {
49entry:
50  %call = tail call float @ceilf(float %a) nounwind readnone
51  ret float %call
52}
53
54declare float @ceilf(float) nounwind readnone
55
56; CHECK-LABEL: test6:
57; CHECK: frintp
58; CHECK-NOT: frintx
59define double @test6(double %a) #0 {
60entry:
61  %call = tail call double @ceil(double %a) nounwind readnone
62  ret double %call
63}
64
65declare double @ceil(double) nounwind readnone
66
67; CHECK-LABEL: test7:
68; CHECK: frintx
69define float @test7(float %a) #0 {
70entry:
71  %call = tail call float @rintf(float %a) nounwind readnone
72  ret float %call
73}
74
75declare float @rintf(float) nounwind readnone
76
77; CHECK-LABEL: test8:
78; CHECK: frintx
79define double @test8(double %a) #0 {
80entry:
81  %call = tail call double @rint(double %a) nounwind readnone
82  ret double %call
83}
84
85declare double @rint(double) nounwind readnone
86
87; CHECK-LABEL: test9:
88; CHECK: frintz
89; CHECK-NOT: frintx
90define float @test9(float %a) #0 {
91entry:
92  %call = tail call float @truncf(float %a) nounwind readnone
93  ret float %call
94}
95
96declare float @truncf(float) nounwind readnone
97
98; CHECK-LABEL: test10:
99; CHECK: frintz
100; CHECK-NOT: frintx
101define double @test10(double %a) #0 {
102entry:
103  %call = tail call double @trunc(double %a) nounwind readnone
104  ret double %call
105}
106
107declare double @trunc(double) nounwind readnone
108
109; CHECK-LABEL: test11:
110; CHECK: frinta
111; CHECK-NOT: frintx
112define float @test11(float %a) #0 {
113entry:
114  %call = tail call float @roundf(float %a) nounwind readnone
115  ret float %call
116}
117
118declare float @roundf(float %a) nounwind readnone
119
120; CHECK-LABEL: test12:
121; CHECK: frinta
122; CHECK-NOT: frintx
123define double @test12(double %a) #0 {
124entry:
125  %call = tail call double @round(double %a) nounwind readnone
126  ret double %call
127}
128
129declare double @round(double %a) nounwind readnone
130
131; CHECK-LABEL: test13:
132; CHECK-NOT: frintx
133; CHECK: frintm
134define float @test13(float %a) #1 {
135entry:
136  %call = tail call float @floorf(float %a) nounwind readnone
137  ret float %call
138}
139
140; CHECK-LABEL: test14:
141; CHECK-NOT: frintx
142; CHECK: frintm
143define double @test14(double %a) #1 {
144entry:
145  %call = tail call double @floor(double %a) nounwind readnone
146  ret double %call
147}
148
149; CHECK-LABEL: test15:
150; CHECK-NOT: frintx
151; CHECK: frintp
152define float @test15(float %a) #1 {
153entry:
154  %call = tail call float @ceilf(float %a) nounwind readnone
155  ret float %call
156}
157
158; CHECK-LABEL: test16:
159; CHECK-NOT: frintx
160; CHECK: frintp
161define double @test16(double %a) #1 {
162entry:
163  %call = tail call double @ceil(double %a) nounwind readnone
164  ret double %call
165}
166
167; CHECK-LABEL: test17:
168; CHECK-NOT: frintx
169; CHECK: frintz
170define float @test17(float %a) #1 {
171entry:
172  %call = tail call float @truncf(float %a) nounwind readnone
173  ret float %call
174}
175
176; CHECK-LABEL: test18:
177; CHECK-NOT: frintx
178; CHECK: frintz
179define double @test18(double %a) #1 {
180entry:
181  %call = tail call double @trunc(double %a) nounwind readnone
182  ret double %call
183}
184
185; CHECK-LABEL: test19:
186; CHECK-NOT: frintx
187; CHECK: frinta
188define float @test19(float %a) #1 {
189entry:
190  %call = tail call float @roundf(float %a) nounwind readnone
191  ret float %call
192}
193
194; CHECK-LABEL: test20:
195; CHECK-NOT: frintx
196; CHECK: frinta
197define double @test20(double %a) #1 {
198entry:
199  %call = tail call double @round(double %a) nounwind readnone
200  ret double %call
201}
202
203attributes #0 = { nounwind }
204attributes #1 = { nounwind "unsafe-fp-math"="true" }
205