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