Skip to content

Commit f62a112

Browse files
committed
[AArch64] Add non-saturating roundeven+fpto[su]i tests
1 parent 9ca61d1 commit f62a112

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

llvm/test/CodeGen/AArch64/round-conv.ll

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@ entry:
250250
ret i32 %conv
251251
}
252252

253+
; CHECK-LABEL: testnsws:
254+
; CHECK: fcvtns w0, s0
255+
; CHECK-NOT: frintx {{s[0-9]+}}, s0
256+
define i32 @testnsws(float %a) {
257+
entry:
258+
%call = call float @llvm.roundeven.f32(float %a)
259+
%conv = fptosi float %call to i32
260+
ret i32 %conv
261+
}
262+
253263
; CHECK-LABEL: testasxs:
254264
; CHECK: fcvtas x0, s0
255265
; CHECK-NOT: frintx {{s[0-9]+}}, s0
@@ -260,6 +270,16 @@ entry:
260270
ret i64 %conv
261271
}
262272

273+
; CHECK-LABEL: testnsxs:
274+
; CHECK: fcvtns x0, s0
275+
; CHECK-NOT: frintx {{s[0-9]+}}, s0
276+
define i64 @testnsxs(float %a) {
277+
entry:
278+
%call = call float @llvm.roundeven.f32(float %a)
279+
%conv = fptosi float %call to i64
280+
ret i64 %conv
281+
}
282+
263283
; CHECK-LABEL: testaswd:
264284
; CHECK: fcvtas w0, d0
265285
; CHECK-NOT: frintx {{d[0-9]+}}, d0
@@ -270,6 +290,16 @@ entry:
270290
ret i32 %conv
271291
}
272292

293+
; CHECK-LABEL: testnswd:
294+
; CHECK: fcvtns w0, d0
295+
; CHECK-NOT: frintx {{d[0-9]+}}, d0
296+
define i32 @testnswd(double %a) {
297+
entry:
298+
%call = call double @llvm.roundeven.f64(double %a)
299+
%conv = fptosi double %call to i32
300+
ret i32 %conv
301+
}
302+
273303
; CHECK-LABEL: testasxd:
274304
; CHECK: fcvtas x0, d0
275305
; CHECK-NOT: frintx {{d[0-9]+}}, d0
@@ -280,6 +310,16 @@ entry:
280310
ret i64 %conv
281311
}
282312

313+
; CHECK-LABEL: testnsxd:
314+
; CHECK: fcvtns x0, d0
315+
; CHECK-NOT: frintx {{d[0-9]+}}, d0
316+
define i64 @testnsxd(double %a) {
317+
entry:
318+
%call = call double @llvm.roundeven.f64(double %a)
319+
%conv = fptosi double %call to i64
320+
ret i64 %conv
321+
}
322+
283323
; CHECK-LABEL: testauws:
284324
; CHECK: fcvtau w0, s0
285325
; CHECK-NOT: frintx {{s[0-9]+}}, s0
@@ -290,6 +330,16 @@ entry:
290330
ret i32 %conv
291331
}
292332

333+
; CHECK-LABEL: testnuws:
334+
; CHECK: fcvtnu w0, s0
335+
; CHECK-NOT: frintx {{s[0-9]+}}, s0
336+
define i32 @testnuws(float %a) {
337+
entry:
338+
%call = call float @llvm.roundeven.f32(float %a)
339+
%conv = fptoui float %call to i32
340+
ret i32 %conv
341+
}
342+
293343
; CHECK-LABEL: testauxs:
294344
; CHECK: fcvtau x0, s0
295345
; CHECK-NOT: frintx {{s[0-9]+}}, s0
@@ -300,6 +350,16 @@ entry:
300350
ret i64 %conv
301351
}
302352

353+
; CHECK-LABEL: testnuxs:
354+
; CHECK: fcvtnu x0, s0
355+
; CHECK-NOT: frintx {{s[0-9]+}}, s0
356+
define i64 @testnuxs(float %a) {
357+
entry:
358+
%call = call float @llvm.roundeven.f32(float %a)
359+
%conv = fptoui float %call to i64
360+
ret i64 %conv
361+
}
362+
303363
; CHECK-LABEL: testauwd:
304364
; CHECK: fcvtau w0, d0
305365
; CHECK-NOT: frintx {{d[0-9]+}}, d0
@@ -310,6 +370,16 @@ entry:
310370
ret i32 %conv
311371
}
312372

373+
; CHECK-LABEL: testnuwd:
374+
; CHECK: fcvtnu w0, d0
375+
; CHECK-NOT: frintx {{d[0-9]+}}, d0
376+
define i32 @testnuwd(double %a) {
377+
entry:
378+
%call = call double @llvm.roundeven.f64(double %a)
379+
%conv = fptoui double %call to i32
380+
ret i32 %conv
381+
}
382+
313383
; CHECK-LABEL: testauxd:
314384
; CHECK: fcvtau x0, d0
315385
; CHECK-NOT: frintx {{d[0-9]+}}, d0
@@ -320,6 +390,16 @@ entry:
320390
ret i64 %conv
321391
}
322392

393+
; CHECK-LABEL: testnuxd:
394+
; CHECK: fcvtnu x0, d0
395+
; CHECK-NOT: frintx {{d[0-9]+}}, d0
396+
define i64 @testnuxd(double %a) {
397+
entry:
398+
%call = call double @llvm.roundeven.f64(double %a)
399+
%conv = fptoui double %call to i64
400+
ret i64 %conv
401+
}
402+
323403
declare float @floorf(float) nounwind readnone
324404
declare double @floor(double) nounwind readnone
325405
declare float @ceilf(float) nounwind readnone
@@ -328,3 +408,5 @@ declare float @truncf(float) nounwind readnone
328408
declare double @trunc(double) nounwind readnone
329409
declare float @roundf(float) nounwind readnone
330410
declare double @round(double) nounwind readnone
411+
declare float @llvm.roundeven.f32(float)
412+
declare double @llvm.roundeven.f64(double)

0 commit comments

Comments
 (0)