AArch64/ARM64: move ARM64 into AArch64's place
[oota-llvm.git] / test / CodeGen / AArch64 / arm64-rounding.ll
1 ; RUN: llc -O3 < %s -mcpu=cyclone | FileCheck %s
2 target 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"
3 target triple = "arm64-apple-ios6.0.0"
4
5 ; CHECK: test1
6 ; CHECK: frintx
7 ; CHECK: frintm
8 define float @test1(float %a) #0 {
9 entry:
10   %call = tail call float @floorf(float %a) nounwind readnone
11   ret float %call
12 }
13
14 declare float @floorf(float) nounwind readnone
15
16 ; CHECK: test2
17 ; CHECK: frintx
18 ; CHECK: frintm
19 define double @test2(double %a) #0 {
20 entry:
21   %call = tail call double @floor(double %a) nounwind readnone
22   ret double %call
23 }
24
25 declare double @floor(double) nounwind readnone
26
27 ; CHECK: test3
28 ; CHECK: frinti
29 define float @test3(float %a) #0 {
30 entry:
31   %call = tail call float @nearbyintf(float %a) nounwind readnone
32   ret float %call
33 }
34
35 declare float @nearbyintf(float) nounwind readnone
36
37 ; CHECK: test4
38 ; CHECK: frinti
39 define double @test4(double %a) #0 {
40 entry:
41   %call = tail call double @nearbyint(double %a) nounwind readnone
42   ret double %call
43 }
44
45 declare double @nearbyint(double) nounwind readnone
46
47 ; CHECK: test5
48 ; CHECK: frintx
49 ; CHECK: frintp
50 define float @test5(float %a) #0 {
51 entry:
52   %call = tail call float @ceilf(float %a) nounwind readnone
53   ret float %call
54 }
55
56 declare float @ceilf(float) nounwind readnone
57
58 ; CHECK: test6
59 ; CHECK: frintx
60 ; CHECK: frintp
61 define double @test6(double %a) #0 {
62 entry:
63   %call = tail call double @ceil(double %a) nounwind readnone
64   ret double %call
65 }
66
67 declare double @ceil(double) nounwind readnone
68
69 ; CHECK: test7
70 ; CHECK: frintx
71 define float @test7(float %a) #0 {
72 entry:
73   %call = tail call float @rintf(float %a) nounwind readnone
74   ret float %call
75 }
76
77 declare float @rintf(float) nounwind readnone
78
79 ; CHECK: test8
80 ; CHECK: frintx
81 define double @test8(double %a) #0 {
82 entry:
83   %call = tail call double @rint(double %a) nounwind readnone
84   ret double %call
85 }
86
87 declare double @rint(double) nounwind readnone
88
89 ; CHECK: test9
90 ; CHECK: frintx
91 ; CHECK: frintz
92 define float @test9(float %a) #0 {
93 entry:
94   %call = tail call float @truncf(float %a) nounwind readnone
95   ret float %call
96 }
97
98 declare float @truncf(float) nounwind readnone
99
100 ; CHECK: test10
101 ; CHECK: frintx
102 ; CHECK: frintz
103 define double @test10(double %a) #0 {
104 entry:
105   %call = tail call double @trunc(double %a) nounwind readnone
106   ret double %call
107 }
108
109 declare double @trunc(double) nounwind readnone
110
111 ; CHECK: test11
112 ; CHECK: frintx
113 ; CHECK: frinta
114 define float @test11(float %a) #0 {
115 entry:
116   %call = tail call float @roundf(float %a) nounwind readnone
117   ret float %call
118 }
119
120 declare float @roundf(float %a) nounwind readnone
121
122 ; CHECK: test12
123 ; CHECK: frintx
124 ; CHECK: frinta
125 define double @test12(double %a) #0 {
126 entry:
127   %call = tail call double @round(double %a) nounwind readnone
128   ret double %call
129 }
130
131 declare double @round(double %a) nounwind readnone
132
133 ; CHECK: test13
134 ; CHECK-NOT: frintx
135 ; CHECK: frintm
136 define float @test13(float %a) #1 {
137 entry:
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
145 define double @test14(double %a) #1 {
146 entry:
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
154 define float @test15(float %a) #1 {
155 entry:
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
163 define double @test16(double %a) #1 {
164 entry:
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
172 define float @test17(float %a) #1 {
173 entry:
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
181 define double @test18(double %a) #1 {
182 entry:
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
190 define float @test19(float %a) #1 {
191 entry:
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
199 define double @test20(double %a) #1 {
200 entry:
201   %call = tail call double @round(double %a) nounwind readnone
202   ret double %call
203 }
204
205
206
207 attributes #0 = { nounwind }
208 attributes #1 = { nounwind "unsafe-fp-math"="true" }