Merging r258471:
[oota-llvm.git] / test / CodeGen / AArch64 / round-conv.ll
1 ; RUN: llc < %s -mtriple=arm64 | FileCheck %s
2
3 ; CHECK-LABEL: testmsws:
4 ; CHECK: fcvtms w0, s0
5 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
6 define i32 @testmsws(float %a) {
7 entry:
8   %call = call float @floorf(float %a) nounwind readnone
9   %conv = fptosi float %call to i32
10   ret i32 %conv
11 }
12
13 ; CHECK-LABEL: testmsxs:
14 ; CHECK: fcvtms x0, s0
15 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
16 define i64 @testmsxs(float %a) {
17 entry:
18   %call = call float @floorf(float %a) nounwind readnone
19   %conv = fptosi float %call to i64
20   ret i64 %conv
21 }
22
23 ; CHECK-LABEL: testmswd:
24 ; CHECK: fcvtms w0, d0
25 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
26 define i32 @testmswd(double %a) {
27 entry:
28   %call = call double @floor(double %a) nounwind readnone
29   %conv = fptosi double %call to i32
30   ret i32 %conv
31 }
32
33 ; CHECK-LABEL: testmsxd:
34 ; CHECK: fcvtms x0, d0
35 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
36 define i64 @testmsxd(double %a) {
37 entry:
38   %call = call double @floor(double %a) nounwind readnone
39   %conv = fptosi double %call to i64
40   ret i64 %conv
41 }
42
43 ; CHECK-LABEL: testmuws:
44 ; CHECK: fcvtmu w0, s0
45 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
46 define i32 @testmuws(float %a) {
47 entry:
48   %call = call float @floorf(float %a) nounwind readnone
49   %conv = fptoui float %call to i32
50   ret i32 %conv
51 }
52
53 ; CHECK-LABEL: testmuxs:
54 ; CHECK: fcvtmu x0, s0
55 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
56 define i64 @testmuxs(float %a) {
57 entry:
58   %call = call float @floorf(float %a) nounwind readnone
59   %conv = fptoui float %call to i64
60   ret i64 %conv
61 }
62
63 ; CHECK-LABEL: testmuwd:
64 ; CHECK: fcvtmu w0, d0
65 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
66 define i32 @testmuwd(double %a) {
67 entry:
68   %call = call double @floor(double %a) nounwind readnone
69   %conv = fptoui double %call to i32
70   ret i32 %conv
71 }
72
73 ; CHECK-LABEL: testmuxd:
74 ; CHECK: fcvtmu x0, d0
75 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
76 define i64 @testmuxd(double %a) {
77 entry:
78   %call = call double @floor(double %a) nounwind readnone
79   %conv = fptoui double %call to i64
80   ret i64 %conv
81 }
82
83 ; CHECK-LABEL: testpsws:
84 ; CHECK: fcvtps w0, s0
85 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
86 define i32 @testpsws(float %a) {
87 entry:
88   %call = call float @ceilf(float %a) nounwind readnone
89   %conv = fptosi float %call to i32
90   ret i32 %conv
91 }
92
93 ; CHECK-LABEL: testpsxs:
94 ; CHECK: fcvtps x0, s0
95 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
96 define i64 @testpsxs(float %a) {
97 entry:
98   %call = call float @ceilf(float %a) nounwind readnone
99   %conv = fptosi float %call to i64
100   ret i64 %conv
101 }
102
103 ; CHECK-LABEL: testpswd:
104 ; CHECK: fcvtps w0, d0
105 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
106 define i32 @testpswd(double %a) {
107 entry:
108   %call = call double @ceil(double %a) nounwind readnone
109   %conv = fptosi double %call to i32
110   ret i32 %conv
111 }
112
113 ; CHECK-LABEL: testpsxd:
114 ; CHECK: fcvtps x0, d0
115 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
116 define i64 @testpsxd(double %a) {
117 entry:
118   %call = call double @ceil(double %a) nounwind readnone
119   %conv = fptosi double %call to i64
120   ret i64 %conv
121 }
122
123 ; CHECK-LABEL: testpuws:
124 ; CHECK: fcvtpu w0, s0
125 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
126 define i32 @testpuws(float %a) {
127 entry:
128   %call = call float @ceilf(float %a) nounwind readnone
129   %conv = fptoui float %call to i32
130   ret i32 %conv
131 }
132
133 ; CHECK-LABEL: testpuxs:
134 ; CHECK: fcvtpu x0, s0
135 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
136 define i64 @testpuxs(float %a) {
137 entry:
138   %call = call float @ceilf(float %a) nounwind readnone
139   %conv = fptoui float %call to i64
140   ret i64 %conv
141 }
142
143 ; CHECK-LABEL: testpuwd:
144 ; CHECK: fcvtpu w0, d0
145 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
146 define i32 @testpuwd(double %a) {
147 entry:
148   %call = call double @ceil(double %a) nounwind readnone
149   %conv = fptoui double %call to i32
150   ret i32 %conv
151 }
152
153 ; CHECK-LABEL: testpuxd:
154 ; CHECK: fcvtpu x0, d0
155 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
156 define i64 @testpuxd(double %a) {
157 entry:
158   %call = call double @ceil(double %a) nounwind readnone
159   %conv = fptoui double %call to i64
160   ret i64 %conv
161 }
162
163 ; CHECK-LABEL: testzsws:
164 ; CHECK: fcvtzs w0, s0
165 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
166 define i32 @testzsws(float %a) {
167 entry:
168   %call = call float @truncf(float %a) nounwind readnone
169   %conv = fptosi float %call to i32
170   ret i32 %conv
171 }
172
173 ; CHECK-LABEL: testzsxs:
174 ; CHECK: fcvtzs x0, s0
175 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
176 define i64 @testzsxs(float %a) {
177 entry:
178   %call = call float @truncf(float %a) nounwind readnone
179   %conv = fptosi float %call to i64
180   ret i64 %conv
181 }
182
183 ; CHECK-LABEL: testzswd:
184 ; CHECK: fcvtzs w0, d0
185 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
186 define i32 @testzswd(double %a) {
187 entry:
188   %call = call double @trunc(double %a) nounwind readnone
189   %conv = fptosi double %call to i32
190   ret i32 %conv
191 }
192
193 ; CHECK-LABEL: testzsxd:
194 ; CHECK: fcvtzs x0, d0
195 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
196 define i64 @testzsxd(double %a) {
197 entry:
198   %call = call double @trunc(double %a) nounwind readnone
199   %conv = fptosi double %call to i64
200   ret i64 %conv
201 }
202
203 ; CHECK-LABEL: testzuws:
204 ; CHECK: fcvtzu w0, s0
205 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
206 define i32 @testzuws(float %a) {
207 entry:
208   %call = call float @truncf(float %a) nounwind readnone
209   %conv = fptoui float %call to i32
210   ret i32 %conv
211 }
212
213 ; CHECK-LABEL: testzuxs:
214 ; CHECK: fcvtzu x0, s0
215 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
216 define i64 @testzuxs(float %a) {
217 entry:
218   %call = call float @truncf(float %a) nounwind readnone
219   %conv = fptoui float %call to i64
220   ret i64 %conv
221 }
222
223 ; CHECK-LABEL: testzuwd:
224 ; CHECK: fcvtzu w0, d0
225 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
226 define i32 @testzuwd(double %a) {
227 entry:
228   %call = call double @trunc(double %a) nounwind readnone
229   %conv = fptoui double %call to i32
230   ret i32 %conv
231 }
232
233 ; CHECK-LABEL: testzuxd:
234 ; CHECK: fcvtzu x0, d0
235 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
236 define i64 @testzuxd(double %a) {
237 entry:
238   %call = call double @trunc(double %a) nounwind readnone
239   %conv = fptoui double %call to i64
240   ret i64 %conv
241 }
242
243 ; CHECK-LABEL: testasws:
244 ; CHECK: fcvtas w0, s0
245 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
246 define i32 @testasws(float %a) {
247 entry:
248   %call = call float @roundf(float %a) nounwind readnone
249   %conv = fptosi float %call to i32
250   ret i32 %conv
251 }
252
253 ; CHECK-LABEL: testasxs:
254 ; CHECK: fcvtas x0, s0
255 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
256 define i64 @testasxs(float %a) {
257 entry:
258   %call = call float @roundf(float %a) nounwind readnone
259   %conv = fptosi float %call to i64
260   ret i64 %conv
261 }
262
263 ; CHECK-LABEL: testaswd:
264 ; CHECK: fcvtas w0, d0
265 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
266 define i32 @testaswd(double %a) {
267 entry:
268   %call = call double @round(double %a) nounwind readnone
269   %conv = fptosi double %call to i32
270   ret i32 %conv
271 }
272
273 ; CHECK-LABEL: testasxd:
274 ; CHECK: fcvtas x0, d0
275 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
276 define i64 @testasxd(double %a) {
277 entry:
278   %call = call double @round(double %a) nounwind readnone
279   %conv = fptosi double %call to i64
280   ret i64 %conv
281 }
282
283 ; CHECK-LABEL: testauws:
284 ; CHECK: fcvtau w0, s0
285 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
286 define i32 @testauws(float %a) {
287 entry:
288   %call = call float @roundf(float %a) nounwind readnone
289   %conv = fptoui float %call to i32
290   ret i32 %conv
291 }
292
293 ; CHECK-LABEL: testauxs:
294 ; CHECK: fcvtau x0, s0
295 ; CHECK-NOT: frintx {{s[0-9]+}}, s0
296 define i64 @testauxs(float %a) {
297 entry:
298   %call = call float @roundf(float %a) nounwind readnone
299   %conv = fptoui float %call to i64
300   ret i64 %conv
301 }
302
303 ; CHECK-LABEL: testauwd:
304 ; CHECK: fcvtau w0, d0
305 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
306 define i32 @testauwd(double %a) {
307 entry:
308   %call = call double @round(double %a) nounwind readnone
309   %conv = fptoui double %call to i32
310   ret i32 %conv
311 }
312
313 ; CHECK-LABEL: testauxd:
314 ; CHECK: fcvtau x0, d0
315 ; CHECK-NOT: frintx {{d[0-9]+}}, d0
316 define i64 @testauxd(double %a) {
317 entry:
318   %call = call double @round(double %a) nounwind readnone
319   %conv = fptoui double %call to i64
320   ret i64 %conv
321 }
322
323 declare float @floorf(float) nounwind readnone
324 declare double @floor(double) nounwind readnone
325 declare float @ceilf(float) nounwind readnone
326 declare double @ceil(double) nounwind readnone
327 declare float @truncf(float) nounwind readnone
328 declare double @trunc(double) nounwind readnone
329 declare float @roundf(float) nounwind readnone
330 declare double @round(double) nounwind readnone