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