[llvm] 700b5f1 - [AArch64] Add test coverage for roundeven + float-to-int conversions (#173515)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 22 18:55:44 PST 2026


Author: valadaptive
Date: 2026-01-22T21:55:40-05:00
New Revision: 700b5f1387a50bfc0e17ff21288ea4ceb3b5cc39

URL: https://github.com/llvm/llvm-project/commit/700b5f1387a50bfc0e17ff21288ea4ceb3b5cc39
DIFF: https://github.com/llvm/llvm-project/commit/700b5f1387a50bfc0e17ff21288ea4ceb3b5cc39.diff

LOG: [AArch64] Add test coverage for roundeven + float-to-int conversions (#173515)

Split off from https://github.com/llvm/llvm-project/pull/170018, which
was becoming a bit of a rats' nest.

This PR:
- Cleans up the `arm64-cvt-simd-fptoi.ll`, `round-conv.ll`,
`round-fptosi-sat-scalar.ll`, and `round-fptoui-sat-scalar.ll`
regression tests, removing `nounwind readnone` annotations from the
rounding function calls. These were changed in #171288 to be LLVM
intrinsics instead of libcalls, so we no longer need to annotate them in
order for them to be compiled to native instructions. I've also removed
the declaration blocks at the end of the files, since they're no longer
necessary.

- Adds `roundeven` tests to the 4 regression tests mentioned above, to
go along with the other rounding functions currently tested.

- Changes `round-conv.ll` to have autogenerated CHECK lines/assertions,
so it's simpler to update.

- Checks with GlobalISel as well in `round-conv.ll`,
`round-fptosi-sat-scalar.ll`, and `round-fptoui-sat-scalar.ll`. The
generated code is identical in `round-conv.ll`, but not yet as good in
the latter two.

The supporting changes are necessary here and would be difficult to
split off for little gain.

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/arm64-cvt-simd-fptoi.ll
    llvm/test/CodeGen/AArch64/round-conv.ll
    llvm/test/CodeGen/AArch64/round-fptosi-sat-scalar.ll
    llvm/test/CodeGen/AArch64/round-fptoui-sat-scalar.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/arm64-cvt-simd-fptoi.ll b/llvm/test/CodeGen/AArch64/arm64-cvt-simd-fptoi.ll
index a729772f2897a..d49a9795546a5 100644
--- a/llvm/test/CodeGen/AArch64/arm64-cvt-simd-fptoi.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-cvt-simd-fptoi.ll
@@ -543,6 +543,154 @@ define double @fcvtau_dd_round_simd(double %a) {
   ret double %bc
 }
 
+define double @fcvtns_ds_roundeven_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_ds_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs x8, s0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_ds_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs d0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = fptosi float %r to i64
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define float @fcvtns_sd_roundeven_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_sd_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs w8, d0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_sd_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs s0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = fptosi double %r to i32
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define float @fcvtns_ss_roundeven_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_ss_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs s0, s0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_ss_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = fptosi float %r to i32
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtns_dd_roundeven_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_dd_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs d0, d0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_dd_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = fptosi double %r to i64
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+
+define double @fcvtnu_ds_roundeven_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_ds_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu x8, s0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_ds_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu d0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = fptoui float %r to i64
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define float @fcvtnu_sd_roundeven_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_sd_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu w8, d0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_sd_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu s0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = fptoui double %r to i32
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define float @fcvtnu_ss_roundeven_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_ss_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu s0, s0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_ss_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = fptoui float %r to i32
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtnu_dd_roundeven_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_dd_roundeven_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu d0, d0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_dd_roundeven_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = fptoui double %r to i64
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
 
 define double @fcvtms_ds_round_simd(float %a) {
 ; CHECK-NOFPRCVT-LABEL: fcvtms_ds_round_simd:
@@ -1153,7 +1301,7 @@ define float @fcvtas_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtas s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1170,7 +1318,7 @@ define double @fcvtas_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtas d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1253,7 +1401,7 @@ define float @fcvtau_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtau s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1270,7 +1418,7 @@ define double @fcvtau_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtau d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1342,6 +1490,230 @@ define double @fcvtau_dd_simd(double %a) {
   ret double %bc
 }
 
+define float @fcvtns_sh_simd(half %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_sh_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn h0, h0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs w8, h0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_sh_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn h0, h0
+; CHECK-NEXT:    fcvtzs s0, h0
+; CHECK-NEXT:    ret
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtns_dh_simd(half %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_dh_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn h0, h0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs x8, h0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_dh_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn h0, h0
+; CHECK-NEXT:    fcvtzs d0, h0
+; CHECK-NEXT:    ret
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define double @fcvtns_ds_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_ds_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs x8, s0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_ds_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs d0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define float @fcvtns_sd_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_sd_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs w8, d0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_sd_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs s0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define float @fcvtns_ss_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_ss_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs s0, s0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_ss_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtns_dd_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtns_dd_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzs d0, d0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtns_dd_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define float @fcvtnu_sh_simd(half %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_sh_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn h0, h0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu w8, h0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_sh_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn h0, h0
+; CHECK-NEXT:    fcvtzu s0, h0
+; CHECK-NEXT:    ret
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtnu_dh_simd(half %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_dh_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn h0, h0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu x8, h0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_dh_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn h0, h0
+; CHECK-NEXT:    fcvtzu d0, h0
+; CHECK-NEXT:    ret
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define double @fcvtnu_ds_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_ds_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu x8, s0
+; CHECK-NOFPRCVT-NEXT:    fmov d0, x8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_ds_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu d0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
+define float @fcvtnu_sd_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_sd_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu w8, d0
+; CHECK-NOFPRCVT-NEXT:    fmov s0, w8
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_sd_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu s0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define float @fcvtnu_ss_simd(float %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_ss_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn s0, s0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu s0, s0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_ss_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.roundeven.f32(float %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
+  %bc = bitcast i32 %i to float
+  ret float %bc
+}
+
+define double @fcvtnu_dd_simd(double %a) {
+; CHECK-NOFPRCVT-LABEL: fcvtnu_dd_simd:
+; CHECK-NOFPRCVT:       // %bb.0:
+; CHECK-NOFPRCVT-NEXT:    frintn d0, d0
+; CHECK-NOFPRCVT-NEXT:    fcvtzu d0, d0
+; CHECK-NOFPRCVT-NEXT:    ret
+;
+; CHECK-LABEL: fcvtnu_dd_simd:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.roundeven.f64(double %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
+  %bc = bitcast i64 %i to double
+  ret double %bc
+}
+
 define float @fcvtms_sh_simd(half %a) {
 ; CHECK-NOFPRCVT-LABEL: fcvtms_sh_simd:
 ; CHECK-NOFPRCVT:       // %bb.0:
@@ -1353,7 +1725,7 @@ define float @fcvtms_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtms s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1370,7 +1742,7 @@ define double @fcvtms_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtms d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1453,7 +1825,7 @@ define float @fcvtmu_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtmu s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1470,7 +1842,7 @@ define double @fcvtmu_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtmu d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1553,7 +1925,7 @@ define float @fcvtps_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtps s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1570,7 +1942,7 @@ define double @fcvtps_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtps d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1653,7 +2025,7 @@ define float @fcvtpu_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtpu s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1670,7 +2042,7 @@ define double @fcvtpu_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtpu d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1753,7 +2125,7 @@ define float @fcvtzs_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtzs s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1770,7 +2142,7 @@ define double @fcvtzs_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtzs d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc
@@ -1853,7 +2225,7 @@ define float @fcvtzu_sh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtzu s0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   %bc = bitcast i32 %i to float
   ret float %bc
@@ -1870,7 +2242,7 @@ define double @fcvtzu_dh_simd(half %a) {
 ; CHECK:       // %bb.0:
 ; CHECK-NEXT:    fcvtzu d0, h0
 ; CHECK-NEXT:    ret
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   %bc = bitcast i64 %i to double
   ret double %bc

diff  --git a/llvm/test/CodeGen/AArch64/round-conv.ll b/llvm/test/CodeGen/AArch64/round-conv.ll
index d78aa207925a4..55a1998589733 100644
--- a/llvm/test/CodeGen/AArch64/round-conv.ll
+++ b/llvm/test/CodeGen/AArch64/round-conv.ll
@@ -1,321 +1,451 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
 ; RUN: llc < %s -mtriple=arm64 | FileCheck %s
+; RUN: llc < %s -mtriple=arm64 -global-isel | FileCheck %s
 
-; CHECK-LABEL: testmsws:
-; CHECK: fcvtms w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testmsws(float %a) {
+; CHECK-LABEL: testmsws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtms w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.floor.f32(float %a) nounwind readnone
+  %call = call float @llvm.floor.f32(float %a)
   %conv = fptosi float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testmsxs:
-; CHECK: fcvtms x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testmsxs(float %a) {
+; CHECK-LABEL: testmsxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtms x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.floor.f32(float %a) nounwind readnone
+  %call = call float @llvm.floor.f32(float %a)
   %conv = fptosi float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testmswd:
-; CHECK: fcvtms w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testmswd(double %a) {
+; CHECK-LABEL: testmswd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtms w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.floor.f64(double %a) nounwind readnone
+  %call = call double @llvm.floor.f64(double %a)
   %conv = fptosi double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testmsxd:
-; CHECK: fcvtms x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testmsxd(double %a) {
+; CHECK-LABEL: testmsxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtms x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.floor.f64(double %a) nounwind readnone
+  %call = call double @llvm.floor.f64(double %a)
   %conv = fptosi double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testmuws:
-; CHECK: fcvtmu w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testmuws(float %a) {
+; CHECK-LABEL: testmuws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtmu w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.floor.f32(float %a) nounwind readnone
+  %call = call float @llvm.floor.f32(float %a)
   %conv = fptoui float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testmuxs:
-; CHECK: fcvtmu x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testmuxs(float %a) {
+; CHECK-LABEL: testmuxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtmu x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.floor.f32(float %a) nounwind readnone
+  %call = call float @llvm.floor.f32(float %a)
   %conv = fptoui float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testmuwd:
-; CHECK: fcvtmu w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testmuwd(double %a) {
+; CHECK-LABEL: testmuwd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtmu w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.floor.f64(double %a) nounwind readnone
+  %call = call double @llvm.floor.f64(double %a)
   %conv = fptoui double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testmuxd:
-; CHECK: fcvtmu x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testmuxd(double %a) {
+; CHECK-LABEL: testmuxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtmu x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.floor.f64(double %a) nounwind readnone
+  %call = call double @llvm.floor.f64(double %a)
   %conv = fptoui double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testpsws:
-; CHECK: fcvtps w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testpsws(float %a) {
+; CHECK-LABEL: testpsws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtps w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %call = call float @llvm.ceil.f32(float %a)
   %conv = fptosi float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testpsxs:
-; CHECK: fcvtps x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testpsxs(float %a) {
+; CHECK-LABEL: testpsxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtps x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %call = call float @llvm.ceil.f32(float %a)
   %conv = fptosi float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testpswd:
-; CHECK: fcvtps w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testpswd(double %a) {
+; CHECK-LABEL: testpswd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtps w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %call = call double @llvm.ceil.f64(double %a)
   %conv = fptosi double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testpsxd:
-; CHECK: fcvtps x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testpsxd(double %a) {
+; CHECK-LABEL: testpsxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtps x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %call = call double @llvm.ceil.f64(double %a)
   %conv = fptosi double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testpuws:
-; CHECK: fcvtpu w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testpuws(float %a) {
+; CHECK-LABEL: testpuws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtpu w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %call = call float @llvm.ceil.f32(float %a)
   %conv = fptoui float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testpuxs:
-; CHECK: fcvtpu x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testpuxs(float %a) {
+; CHECK-LABEL: testpuxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtpu x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %call = call float @llvm.ceil.f32(float %a)
   %conv = fptoui float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testpuwd:
-; CHECK: fcvtpu w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testpuwd(double %a) {
+; CHECK-LABEL: testpuwd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtpu w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %call = call double @llvm.ceil.f64(double %a)
   %conv = fptoui double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testpuxd:
-; CHECK: fcvtpu x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testpuxd(double %a) {
+; CHECK-LABEL: testpuxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtpu x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %call = call double @llvm.ceil.f64(double %a)
   %conv = fptoui double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testzsws:
-; CHECK: fcvtzs w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testzsws(float %a) {
+; CHECK-LABEL: testzsws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %call = call float @llvm.trunc.f32(float %a)
   %conv = fptosi float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testzsxs:
-; CHECK: fcvtzs x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testzsxs(float %a) {
+; CHECK-LABEL: testzsxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzs x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %call = call float @llvm.trunc.f32(float %a)
   %conv = fptosi float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testzswd:
-; CHECK: fcvtzs w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testzswd(double %a) {
+; CHECK-LABEL: testzswd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzs w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %call = call double @llvm.trunc.f64(double %a)
   %conv = fptosi double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testzsxd:
-; CHECK: fcvtzs x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testzsxd(double %a) {
+; CHECK-LABEL: testzsxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzs x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %call = call double @llvm.trunc.f64(double %a)
   %conv = fptosi double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testzuws:
-; CHECK: fcvtzu w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testzuws(float %a) {
+; CHECK-LABEL: testzuws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %call = call float @llvm.trunc.f32(float %a)
   %conv = fptoui float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testzuxs:
-; CHECK: fcvtzu x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testzuxs(float %a) {
+; CHECK-LABEL: testzuxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %call = call float @llvm.trunc.f32(float %a)
   %conv = fptoui float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testzuwd:
-; CHECK: fcvtzu w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testzuwd(double %a) {
+; CHECK-LABEL: testzuwd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzu w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %call = call double @llvm.trunc.f64(double %a)
   %conv = fptoui double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testzuxd:
-; CHECK: fcvtzu x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testzuxd(double %a) {
+; CHECK-LABEL: testzuxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtzu x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %call = call double @llvm.trunc.f64(double %a)
   %conv = fptoui double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testasws:
-; CHECK: fcvtas w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testasws(float %a) {
+; CHECK-LABEL: testasws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtas w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.round.f32(float %a) nounwind readnone
+  %call = call float @llvm.round.f32(float %a)
+  %conv = fptosi float %call to i32
+  ret i32 %conv
+}
+
+define i32 @testnsws(float %a) {
+; CHECK-LABEL: testnsws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %call = call float @llvm.roundeven.f32(float %a)
   %conv = fptosi float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testasxs:
-; CHECK: fcvtas x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testasxs(float %a) {
+; CHECK-LABEL: testasxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtas x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.round.f32(float %a) nounwind readnone
+  %call = call float @llvm.round.f32(float %a)
+  %conv = fptosi float %call to i64
+  ret i64 %conv
+}
+
+define i64 @testnsxs(float %a) {
+; CHECK-LABEL: testnsxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %call = call float @llvm.roundeven.f32(float %a)
   %conv = fptosi float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testaswd:
-; CHECK: fcvtas w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testaswd(double %a) {
+; CHECK-LABEL: testaswd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtas w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.round.f64(double %a) nounwind readnone
+  %call = call double @llvm.round.f64(double %a)
+  %conv = fptosi double %call to i32
+  ret i32 %conv
+}
+
+define i32 @testnswd(double %a) {
+; CHECK-LABEL: testnswd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs w0, d0
+; CHECK-NEXT:    ret
+entry:
+  %call = call double @llvm.roundeven.f64(double %a)
   %conv = fptosi double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testasxd:
-; CHECK: fcvtas x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testasxd(double %a) {
+; CHECK-LABEL: testasxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtas x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.round.f64(double %a) nounwind readnone
+  %call = call double @llvm.round.f64(double %a)
+  %conv = fptosi double %call to i64
+  ret i64 %conv
+}
+
+define i64 @testnsxd(double %a) {
+; CHECK-LABEL: testnsxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs x0, d0
+; CHECK-NEXT:    ret
+entry:
+  %call = call double @llvm.roundeven.f64(double %a)
   %conv = fptosi double %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testauws:
-; CHECK: fcvtau w0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i32 @testauws(float %a) {
+; CHECK-LABEL: testauws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtau w0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.round.f32(float %a) nounwind readnone
+  %call = call float @llvm.round.f32(float %a)
+  %conv = fptoui float %call to i32
+  ret i32 %conv
+}
+
+define i32 @testnuws(float %a) {
+; CHECK-LABEL: testnuws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %call = call float @llvm.roundeven.f32(float %a)
   %conv = fptoui float %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testauxs:
-; CHECK: fcvtau x0, s0
-; CHECK-NOT: frintx {{s[0-9]+}}, s0
 define i64 @testauxs(float %a) {
+; CHECK-LABEL: testauxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtau x0, s0
+; CHECK-NEXT:    ret
 entry:
-  %call = call float @llvm.round.f32(float %a) nounwind readnone
+  %call = call float @llvm.round.f32(float %a)
+  %conv = fptoui float %call to i64
+  ret i64 %conv
+}
+
+define i64 @testnuxs(float %a) {
+; CHECK-LABEL: testnuxs:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %call = call float @llvm.roundeven.f32(float %a)
   %conv = fptoui float %call to i64
   ret i64 %conv
 }
 
-; CHECK-LABEL: testauwd:
-; CHECK: fcvtau w0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i32 @testauwd(double %a) {
+; CHECK-LABEL: testauwd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtau w0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.round.f64(double %a) nounwind readnone
+  %call = call double @llvm.round.f64(double %a)
+  %conv = fptoui double %call to i32
+  ret i32 %conv
+}
+
+define i32 @testnuwd(double %a) {
+; CHECK-LABEL: testnuwd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu w0, d0
+; CHECK-NEXT:    ret
+entry:
+  %call = call double @llvm.roundeven.f64(double %a)
   %conv = fptoui double %call to i32
   ret i32 %conv
 }
 
-; CHECK-LABEL: testauxd:
-; CHECK: fcvtau x0, d0
-; CHECK-NOT: frintx {{d[0-9]+}}, d0
 define i64 @testauxd(double %a) {
+; CHECK-LABEL: testauxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fcvtau x0, d0
+; CHECK-NEXT:    ret
+entry:
+  %call = call double @llvm.round.f64(double %a)
+  %conv = fptoui double %call to i64
+  ret i64 %conv
+}
+
+define i64 @testnuxd(double %a) {
+; CHECK-LABEL: testnuxd:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu x0, d0
+; CHECK-NEXT:    ret
 entry:
-  %call = call double @llvm.round.f64(double %a) nounwind readnone
+  %call = call double @llvm.roundeven.f64(double %a)
   %conv = fptoui double %call to i64
   ret i64 %conv
 }

diff  --git a/llvm/test/CodeGen/AArch64/round-fptosi-sat-scalar.ll b/llvm/test/CodeGen/AArch64/round-fptosi-sat-scalar.ll
index e252cf524f04d..1c6b5992b0fc2 100644
--- a/llvm/test/CodeGen/AArch64/round-fptosi-sat-scalar.ll
+++ b/llvm/test/CodeGen/AArch64/round-fptosi-sat-scalar.ll
@@ -1,6 +1,19 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=aarch64 | FileCheck %s --check-prefixes=CHECK,CHECK-CVT
 ; RUN: llc < %s -mtriple=aarch64 -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
+; RUN: llc < %s -mtriple=aarch64 -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
+; RUN: llc < %s -mtriple aarch64 -global-isel -global-isel-abort=2 -mattr=+fullfp16 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI-FP16
+
+; CHECK-GI-FP16:       warning: Instruction selection used fallback path for testmswbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testmsxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testpswbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testpsxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testzswbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testzsxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testaswbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testasxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testnswbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testnsxbf
 
 ; Round towards minus infinity (fcvtms).
 
@@ -21,7 +34,7 @@ define i32 @testmswbf(bfloat %a) {
 ; CHECK-NEXT:    fcvtzs w0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call bfloat @llvm.floor.bf16(bfloat %a) nounwind readnone
+  %r = call bfloat @llvm.floor.bf16(bfloat %a)
   %i = call i32 @llvm.fptosi.sat.i32.bf16(bfloat %r)
   ret i32 %i
 }
@@ -43,7 +56,7 @@ define i64 @testmsxbf(bfloat %a) {
 ; CHECK-NEXT:    fcvtzs x0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call bfloat @llvm.floor.bf16(bfloat %a) nounwind readnone
+  %r = call bfloat @llvm.floor.bf16(bfloat %a)
   %i = call i64 @llvm.fptosi.sat.i64.bf16(bfloat %r)
   ret i64 %i
 }
@@ -62,8 +75,31 @@ define i32 @testmswh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtms w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmswh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmswh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmswh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintm s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -82,52 +118,163 @@ define i64 @testmsxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtms x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmsxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmsxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmsxh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintm s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testmsws(float %a) {
-; CHECK-LABEL: testmsws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtms w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmsws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtms w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmsws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtms w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmsws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmsws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmsws:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintm s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.floor.f32(float %a) nounwind readnone
+  %r = call float @llvm.floor.f32(float %a)
   %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testmsxs(float %a) {
-; CHECK-LABEL: testmsxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtms x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmsxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtms x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmsxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtms x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmsxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmsxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmsxs:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintm s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.floor.f32(float %a) nounwind readnone
+  %r = call float @llvm.floor.f32(float %a)
   %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testmswd(double %a) {
-; CHECK-LABEL: testmswd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtms w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmswd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtms w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmswd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtms w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmswd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm d0, d0
+; CHECK-GI-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmswd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmswd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintm d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.floor.f64(double %a) nounwind readnone
+  %r = call double @llvm.floor.f64(double %a)
   %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testmsxd(double %a) {
-; CHECK-LABEL: testmsxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtms x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmsxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtms x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmsxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtms x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmsxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm d0, d0
+; CHECK-GI-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmsxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testmsxd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintm d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.floor.f64(double %a) nounwind readnone
+  %r = call double @llvm.floor.f64(double %a)
   %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
   ret i64 %i
 }
@@ -151,7 +298,7 @@ define i32 @testpswbf(bfloat %a) {
 ; CHECK-NEXT:    fcvtzs w0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call bfloat @llvm.ceil.bf16(bfloat %a) nounwind readnone
+  %r = call bfloat @llvm.ceil.bf16(bfloat %a)
   %i = call i32 @llvm.fptosi.sat.i32.bf16(bfloat %r)
   ret i32 %i
 }
@@ -173,7 +320,7 @@ define i64 @testpsxbf(bfloat %a) {
 ; CHECK-NEXT:    fcvtzs x0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call bfloat @llvm.ceil.bf16(bfloat %a) nounwind readnone
+  %r = call bfloat @llvm.ceil.bf16(bfloat %a)
   %i = call i64 @llvm.fptosi.sat.i64.bf16(bfloat %r)
   ret i64 %i
 }
@@ -192,8 +339,31 @@ define i32 @testpswh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtps w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpswh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpswh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpswh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintp s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -212,58 +382,213 @@ define i64 @testpsxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtps x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpsxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpsxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpsxh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintp s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testpsws(float %a) {
-; CHECK-LABEL: testpsws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtps w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpsws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtps w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpsws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtps w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpsws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpsws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpsws:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintp s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %r = call float @llvm.ceil.f32(float %a)
   %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testpsxs(float %a) {
-; CHECK-LABEL: testpsxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtps x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpsxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtps x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpsxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtps x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpsxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpsxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpsxs:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintp s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %r = call float @llvm.ceil.f32(float %a)
   %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testpswd(double %a) {
-; CHECK-LABEL: testpswd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtps w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpswd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtps w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpswd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtps w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpswd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp d0, d0
+; CHECK-GI-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpswd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpswd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintp d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %r = call double @llvm.ceil.f64(double %a)
   %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testpsxd(double %a) {
-; CHECK-LABEL: testpsxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtps x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpsxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtps x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpsxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtps x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpsxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp d0, d0
+; CHECK-GI-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpsxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testpsxd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintp d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %r = call double @llvm.ceil.f64(double %a)
   %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
   ret i64 %i
 }
 
 ; Round towards zero (fcvtzs).
 
+define i32 @testzswbf(bfloat %a) {
+; CHECK-LABEL: testzswbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintz s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.trunc.bf16(bfloat %a)
+  %i = call i32 @llvm.fptosi.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testzsxbf(bfloat %a) {
+; CHECK-LABEL: testzsxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintz s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.trunc.bf16(bfloat %a)
+  %i = call i64 @llvm.fptosi.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testzswh(half %a) {
 ; CHECK-CVT-LABEL: testzswh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -278,8 +603,31 @@ define i32 @testzswh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtzs w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzswh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzswh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzswh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintz s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -298,58 +646,213 @@ define i64 @testzsxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtzs x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzsxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzsxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzsxh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintz s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testzsws(float %a) {
-; CHECK-LABEL: testzsws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzs w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzsws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzs w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzsws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzs w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzsws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzsws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzsws:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintz s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %r = call float @llvm.trunc.f32(float %a)
   %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testzsxs(float %a) {
-; CHECK-LABEL: testzsxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzs x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzsxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzs x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzsxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzs x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzsxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzsxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzsxs:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintz s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %r = call float @llvm.trunc.f32(float %a)
   %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testzswd(double %a) {
-; CHECK-LABEL: testzswd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzs w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzswd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzs w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzswd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzs w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzswd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz d0, d0
+; CHECK-GI-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzswd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzswd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintz d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %r = call double @llvm.trunc.f64(double %a)
   %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testzsxd(double %a) {
-; CHECK-LABEL: testzsxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzs x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzsxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzs x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzsxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzs x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzsxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz d0, d0
+; CHECK-GI-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzsxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testzsxd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frintz d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %r = call double @llvm.trunc.f64(double %a)
   %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
   ret i64 %i
 }
 
 ; Round to nearest, ties away from zero (fcvtas).
 
+define i32 @testaswbf(bfloat %a) {
+; CHECK-LABEL: testaswbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frinta s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.round.bf16(bfloat %a)
+  %i = call i32 @llvm.fptosi.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testasxbf(bfloat %a) {
+; CHECK-LABEL: testasxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frinta s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.round.bf16(bfloat %a)
+  %i = call i64 @llvm.fptosi.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testaswh(half %a) {
 ; CHECK-CVT-LABEL: testaswh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -364,8 +867,31 @@ define i32 @testaswh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtas w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testaswh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testaswh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testaswh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frinta s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -384,78 +910,345 @@ define i64 @testasxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtas x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testasxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testasxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testasxh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frinta s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
 entry:
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testasws(float %a) {
-; CHECK-LABEL: testasws:
+; CHECK-CVT-LABEL: testasws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtas w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testasws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtas w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testasws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testasws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testasws:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frinta s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call float @llvm.round.f32(float %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
+  ret i32 %i
+}
+
+define i64 @testasxs(float %a) {
+; CHECK-CVT-LABEL: testasxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtas x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testasxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtas x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testasxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testasxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testasxs:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frinta s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call float @llvm.round.f32(float %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
+  ret i64 %i
+}
+
+define i32 @testaswd(double %a) {
+; CHECK-CVT-LABEL: testaswd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtas w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testaswd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtas w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testaswd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta d0, d0
+; CHECK-GI-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testaswd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testaswd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frinta d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call double @llvm.round.f64(double %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
+  ret i32 %i
+}
+
+define i64 @testasxd(double %a) {
+; CHECK-CVT-LABEL: testasxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtas x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testasxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtas x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testasxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta d0, d0
+; CHECK-GI-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testasxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testasxd:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    frinta d0, d0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, d0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call double @llvm.round.f64(double %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
+  ret i64 %i
+}
+
+; Round to nearest, ties to even (fcvtns).
+
+define i32 @testnswbf(bfloat %a) {
+; CHECK-LABEL: testnswbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.roundeven.bf16(bfloat %a)
+  %i = call i32 @llvm.fptosi.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testnsxbf(bfloat %a) {
+; CHECK-LABEL: testnsxbf:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtas w0, s0
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzs x0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call float @llvm.round.f32(float %a) nounwind readnone
+  %r = call bfloat @llvm.roundeven.bf16(bfloat %a)
+  %i = call i64 @llvm.fptosi.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
+define i32 @testnswh(half %a) {
+; CHECK-CVT-LABEL: testnswh:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    frintn s0, s0
+; CHECK-CVT-NEXT:    fcvt h0, s0
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    fcvtzs w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testnswh:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    frintn h0, h0
+; CHECK-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testnswh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintn s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testnswh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintn h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testnswh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintn s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i32 @llvm.fptosi.sat.i32.f16(half %r)
+  ret i32 %i
+}
+
+define i64 @testnsxh(half %a) {
+; CHECK-CVT-LABEL: testnsxh:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    frintn s0, s0
+; CHECK-CVT-NEXT:    fcvt h0, s0
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    fcvtzs x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testnsxh:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    frintn h0, h0
+; CHECK-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testnsxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintn s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testnsxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintn h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+; CHECK-GI-NOFP16-LABEL: testnsxh:
+; CHECK-GI-NOFP16:       // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    frintn s0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt h0, s0
+; CHECK-GI-NOFP16-NEXT:    fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT:    fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT:    ret
+entry:
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i64 @llvm.fptosi.sat.i64.f16(half %r)
+  ret i64 %i
+}
+
+define i32 @testnsws(float %a) {
+; CHECK-LABEL: testnsws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call float @llvm.roundeven.f32(float %a)
   %i = call i32 @llvm.fptosi.sat.i32.f32(float %r)
   ret i32 %i
 }
 
-define i64 @testasxs(float %a) {
-; CHECK-LABEL: testasxs:
+define i64 @testnsxs(float %a) {
+; CHECK-LABEL: testnsxs:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtas x0, s0
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzs x0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call float @llvm.round.f32(float %a) nounwind readnone
+  %r = call float @llvm.roundeven.f32(float %a)
   %i = call i64 @llvm.fptosi.sat.i64.f32(float %r)
   ret i64 %i
 }
 
-define i32 @testaswd(double %a) {
-; CHECK-LABEL: testaswd:
+define i32 @testnswd(double %a) {
+; CHECK-LABEL: testnswd:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtas w0, d0
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs w0, d0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call double @llvm.round.f64(double %a) nounwind readnone
+  %r = call double @llvm.roundeven.f64(double %a)
   %i = call i32 @llvm.fptosi.sat.i32.f64(double %r)
   ret i32 %i
 }
 
-define i64 @testasxd(double %a) {
-; CHECK-LABEL: testasxd:
+define i64 @testnsxd(double %a) {
+; CHECK-LABEL: testnsxd:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtas x0, d0
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzs x0, d0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call double @llvm.round.f64(double %a) nounwind readnone
+  %r = call double @llvm.roundeven.f64(double %a)
   %i = call i64 @llvm.fptosi.sat.i64.f64(double %r)
   ret i64 %i
 }
-
-declare i32 @llvm.fptosi.sat.i32.bf16 (bfloat)
-declare i64 @llvm.fptosi.sat.i64.bf16 (bfloat)
-declare i32 @llvm.fptosi.sat.i32.f16 (half)
-declare i64 @llvm.fptosi.sat.i64.f16 (half)
-declare i32 @llvm.fptosi.sat.i32.f32 (float)
-declare i64 @llvm.fptosi.sat.i64.f32 (float)
-declare i32 @llvm.fptosi.sat.i32.f64 (double)
-declare i64 @llvm.fptosi.sat.i64.f64 (double)
-
-declare bfloat @llvm.floor.bf16(bfloat) nounwind readnone
-declare bfloat @llvm.ceil.bf16(bfloat) nounwind readnone
-declare bfloat @llvm.trunc.bf16(bfloat) nounwind readnone
-declare bfloat @llvm.round.bf16(bfloat) nounwind readnone
-declare half @llvm.floor.f16(half) nounwind readnone
-declare half @llvm.ceil.f16(half) nounwind readnone
-declare half @llvm.trunc.f16(half) nounwind readnone
-declare half @llvm.round.f16(half) nounwind readnone
-declare float @llvm.floor.f32(float) nounwind readnone
-declare float @llvm.ceil.f32(float) nounwind readnone
-declare float @llvm.trunc.f32(float) nounwind readnone
-declare float @llvm.round.f32(float) nounwind readnone
-declare double @llvm.floor.f64(double) nounwind readnone
-declare double @llvm.ceil.f64(double) nounwind readnone
-declare double @llvm.trunc.f64(double) nounwind readnone
-declare double @llvm.round.f64(double) nounwind readnone

diff  --git a/llvm/test/CodeGen/AArch64/round-fptoui-sat-scalar.ll b/llvm/test/CodeGen/AArch64/round-fptoui-sat-scalar.ll
index 308ed13d0b8e2..5af48de2d47c4 100644
--- a/llvm/test/CodeGen/AArch64/round-fptoui-sat-scalar.ll
+++ b/llvm/test/CodeGen/AArch64/round-fptoui-sat-scalar.ll
@@ -1,9 +1,66 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=aarch64 | FileCheck %s --check-prefixes=CHECK,CHECK-CVT
 ; RUN: llc < %s -mtriple=aarch64 -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
+; RUN: llc < %s -mtriple=aarch64 -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
+; RUN: llc < %s -mtriple aarch64 -global-isel -global-isel-abort=2 -mattr=+fullfp16 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI-FP16
+
+; CHECK-GI-FP16:       warning: Instruction selection used fallback path for testmuwbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testmuxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testpuwbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testpuxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testzuwbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testzuxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testauwbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testauxbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testnuwbf
+; CHECK-GI-FP16-NEXT:  warning: Instruction selection used fallback path for testnuxbf
 
 ; Round towards minus infinity (fcvtmu).
 
+define i32 @testmuwbf(bfloat %a) {
+; CHECK-LABEL: testmuwbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintm s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.floor.bf16(bfloat %a)
+  %i = call i32 @llvm.fptoui.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testmuxbf(bfloat %a) {
+; CHECK-LABEL: testmuxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintm s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.floor.bf16(bfloat %a)
+  %i = call i64 @llvm.fptoui.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testmuwh(half %a) {
 ; CHECK-CVT-LABEL: testmuwh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -18,8 +75,23 @@ define i32 @testmuwh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtmu w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuwh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuwh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -38,58 +110,185 @@ define i64 @testmuxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtmu x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.floor.f16(half %a) nounwind readnone
+  %r = call half @llvm.floor.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testmuws(float %a) {
-; CHECK-LABEL: testmuws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtmu w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmuws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtmu w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmuws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtmu w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.floor.f32(float %a) nounwind readnone
+  %r = call float @llvm.floor.f32(float %a)
   %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testmuxs(float %a) {
-; CHECK-LABEL: testmuxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtmu x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmuxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtmu x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmuxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtmu x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm s0, s0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.floor.f32(float %a) nounwind readnone
+  %r = call float @llvm.floor.f32(float %a)
   %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testmuwd(double %a) {
-; CHECK-LABEL: testmuwd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtmu w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmuwd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtmu w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmuwd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtmu w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuwd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm d0, d0
+; CHECK-GI-NEXT:    fcvtzu w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuwd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.floor.f64(double %a) nounwind readnone
+  %r = call double @llvm.floor.f64(double %a)
   %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testmuxd(double %a) {
-; CHECK-LABEL: testmuxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtmu x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testmuxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtmu x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testmuxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtmu x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testmuxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintm d0, d0
+; CHECK-GI-NEXT:    fcvtzu x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testmuxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintm d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.floor.f64(double %a) nounwind readnone
+  %r = call double @llvm.floor.f64(double %a)
   %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
   ret i64 %i
 }
 
 ; Round towards plus infinity (fcvtpu).
 
+define i32 @testpuwbf(bfloat %a) {
+; CHECK-LABEL: testpuwbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintp s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.ceil.bf16(bfloat %a)
+  %i = call i32 @llvm.fptoui.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testpuxbf(bfloat %a) {
+; CHECK-LABEL: testpuxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintp s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.ceil.bf16(bfloat %a)
+  %i = call i64 @llvm.fptoui.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testpuwh(half %a) {
 ; CHECK-CVT-LABEL: testpuwh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -104,8 +303,23 @@ define i32 @testpuwh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtpu w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuwh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuwh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -124,58 +338,185 @@ define i64 @testpuxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtpu x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.ceil.f16(half %a) nounwind readnone
+  %r = call half @llvm.ceil.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testpuws(float %a) {
-; CHECK-LABEL: testpuws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtpu w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpuws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtpu w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpuws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtpu w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %r = call float @llvm.ceil.f32(float %a)
   %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testpuxs(float %a) {
-; CHECK-LABEL: testpuxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtpu x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpuxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtpu x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpuxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtpu x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp s0, s0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.ceil.f32(float %a) nounwind readnone
+  %r = call float @llvm.ceil.f32(float %a)
   %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testpuwd(double %a) {
-; CHECK-LABEL: testpuwd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtpu w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpuwd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtpu w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpuwd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtpu w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuwd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp d0, d0
+; CHECK-GI-NEXT:    fcvtzu w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuwd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %r = call double @llvm.ceil.f64(double %a)
   %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testpuxd(double %a) {
-; CHECK-LABEL: testpuxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtpu x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testpuxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtpu x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testpuxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtpu x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testpuxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintp d0, d0
+; CHECK-GI-NEXT:    fcvtzu x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testpuxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintp d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.ceil.f64(double %a) nounwind readnone
+  %r = call double @llvm.ceil.f64(double %a)
   %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
   ret i64 %i
 }
 
 ; Round towards zero (fcvtzu).
 
+define i32 @testzuwbf(bfloat %a) {
+; CHECK-LABEL: testzuwbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintz s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.trunc.bf16(bfloat %a)
+  %i = call i32 @llvm.fptoui.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testzuxbf(bfloat %a) {
+; CHECK-LABEL: testzuxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintz s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.trunc.bf16(bfloat %a)
+  %i = call i64 @llvm.fptoui.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testzuwh(half %a) {
 ; CHECK-CVT-LABEL: testzuwh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -190,8 +531,23 @@ define i32 @testzuwh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtzu w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuwh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuwh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -210,58 +566,185 @@ define i64 @testzuxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtzu x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.trunc.f16(half %a) nounwind readnone
+  %r = call half @llvm.trunc.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testzuws(float %a) {
-; CHECK-LABEL: testzuws:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzu w0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzuws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzu w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzuws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzu w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %r = call float @llvm.trunc.f32(float %a)
   %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
   ret i32 %i
 }
 
 define i64 @testzuxs(float %a) {
-; CHECK-LABEL: testzuxs:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzu x0, s0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzuxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzu x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzuxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzu x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz s0, s0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, s0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call float @llvm.trunc.f32(float %a) nounwind readnone
+  %r = call float @llvm.trunc.f32(float %a)
   %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
   ret i64 %i
 }
 
 define i32 @testzuwd(double %a) {
-; CHECK-LABEL: testzuwd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzu w0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzuwd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzu w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzuwd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzu w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuwd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz d0, d0
+; CHECK-GI-NEXT:    fcvtzu w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuwd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %r = call double @llvm.trunc.f64(double %a)
   %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
   ret i32 %i
 }
 
 define i64 @testzuxd(double %a) {
-; CHECK-LABEL: testzuxd:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtzu x0, d0
-; CHECK-NEXT:    ret
+; CHECK-CVT-LABEL: testzuxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtzu x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testzuxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtzu x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testzuxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frintz d0, d0
+; CHECK-GI-NEXT:    fcvtzu x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testzuxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintz d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, d0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call double @llvm.trunc.f64(double %a) nounwind readnone
+  %r = call double @llvm.trunc.f64(double %a)
   %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
   ret i64 %i
 }
 
 ; Round to nearest, ties away from zero (fcvtau).
 
+define i32 @testauwbf(bfloat %a) {
+; CHECK-LABEL: testauwbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frinta s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.round.bf16(bfloat %a)
+  %i = call i32 @llvm.fptoui.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testauxbf(bfloat %a) {
+; CHECK-LABEL: testauxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frinta s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.round.bf16(bfloat %a)
+  %i = call i64 @llvm.fptoui.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
 define i32 @testauwh(half %a) {
 ; CHECK-CVT-LABEL: testauwh:
 ; CHECK-CVT:       // %bb.0: // %entry
@@ -276,8 +759,23 @@ define i32 @testauwh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtau w0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauwh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauwh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
   ret i32 %i
 }
@@ -296,72 +794,301 @@ define i64 @testauxh(half %a) {
 ; CHECK-FP16:       // %bb.0: // %entry
 ; CHECK-FP16-NEXT:    fcvtau x0, h0
 ; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT:    ret
 entry:
-  %r = call half @llvm.round.f16(half %a) nounwind readnone
+  %r = call half @llvm.round.f16(half %a)
   %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
   ret i64 %i
 }
 
 define i32 @testauws(float %a) {
-; CHECK-LABEL: testauws:
+; CHECK-CVT-LABEL: testauws:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtau w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testauws:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtau w0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauws:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauws:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, s0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call float @llvm.round.f32(float %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
+  ret i32 %i
+}
+
+define i64 @testauxs(float %a) {
+; CHECK-CVT-LABEL: testauxs:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtau x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testauxs:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtau x0, s0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauxs:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta s0, s0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauxs:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta s0, s0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, s0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call float @llvm.round.f32(float %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
+  ret i64 %i
+}
+
+define i32 @testauwd(double %a) {
+; CHECK-CVT-LABEL: testauwd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtau w0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testauwd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtau w0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauwd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta d0, d0
+; CHECK-GI-NEXT:    fcvtzu w0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauwd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, d0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call double @llvm.round.f64(double %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
+  ret i32 %i
+}
+
+define i64 @testauxd(double %a) {
+; CHECK-CVT-LABEL: testauxd:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvtau x0, d0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testauxd:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    fcvtau x0, d0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testauxd:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    frinta d0, d0
+; CHECK-GI-NEXT:    fcvtzu x0, d0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testauxd:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frinta d0, d0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, d0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call double @llvm.round.f64(double %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
+  ret i64 %i
+}
+
+; Round to nearest, ties to even (fcvtnu).
+
+define i32 @testnuwbf(bfloat %a) {
+; CHECK-LABEL: testnuwbf:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtau w0, s0
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu w0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call float @llvm.round.f32(float %a) nounwind readnone
+  %r = call bfloat @llvm.roundeven.bf16(bfloat %a)
+  %i = call i32 @llvm.fptoui.sat.i32.bf16(bfloat %r)
+  ret i32 %i
+}
+
+define i64 @testnuxbf(bfloat %a) {
+; CHECK-LABEL: testnuxbf:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    // kill: def $h0 killed $h0 def $d0
+; CHECK-NEXT:    mov w8, #32767 // =0x7fff
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fmov w9, s0
+; CHECK-NEXT:    ubfx w10, w9, #16, #1
+; CHECK-NEXT:    add w8, w9, w8
+; CHECK-NEXT:    add w8, w10, w8
+; CHECK-NEXT:    lsr w8, w8, #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    shll v0.4s, v0.4h, #16
+; CHECK-NEXT:    fcvtzu x0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call bfloat @llvm.roundeven.bf16(bfloat %a)
+  %i = call i64 @llvm.fptoui.sat.i64.bf16(bfloat %r)
+  ret i64 %i
+}
+
+define i32 @testnuwh(half %a) {
+; CHECK-CVT-LABEL: testnuwh:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    frintn s0, s0
+; CHECK-CVT-NEXT:    fcvt h0, s0
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    fcvtzu w0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testnuwh:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    frintn h0, h0
+; CHECK-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testnuwh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintn s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu w0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testnuwh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintn h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i32 @llvm.fptoui.sat.i32.f16(half %r)
+  ret i32 %i
+}
+
+define i64 @testnuxh(half %a) {
+; CHECK-CVT-LABEL: testnuxh:
+; CHECK-CVT:       // %bb.0: // %entry
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    frintn s0, s0
+; CHECK-CVT-NEXT:    fcvt h0, s0
+; CHECK-CVT-NEXT:    fcvt s0, h0
+; CHECK-CVT-NEXT:    fcvtzu x0, s0
+; CHECK-CVT-NEXT:    ret
+;
+; CHECK-FP16-LABEL: testnuxh:
+; CHECK-FP16:       // %bb.0: // %entry
+; CHECK-FP16-NEXT:    frintn h0, h0
+; CHECK-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-FP16-NEXT:    ret
+;
+; CHECK-GI-LABEL: testnuxh:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    frintn s0, s0
+; CHECK-GI-NEXT:    fcvt h0, s0
+; CHECK-GI-NEXT:    fcvt s0, h0
+; CHECK-GI-NEXT:    fcvtzu x0, s0
+; CHECK-GI-NEXT:    ret
+;
+; CHECK-GI-FP16-LABEL: testnuxh:
+; CHECK-GI-FP16:       // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT:    frintn h0, h0
+; CHECK-GI-FP16-NEXT:    fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT:    ret
+entry:
+  %r = call half @llvm.roundeven.f16(half %a)
+  %i = call i64 @llvm.fptoui.sat.i64.f16(half %r)
+  ret i64 %i
+}
+
+define i32 @testnuws(float %a) {
+; CHECK-LABEL: testnuws:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu w0, s0
+; CHECK-NEXT:    ret
+entry:
+  %r = call float @llvm.roundeven.f32(float %a)
   %i = call i32 @llvm.fptoui.sat.i32.f32(float %r)
   ret i32 %i
 }
 
-define i64 @testauxs(float %a) {
-; CHECK-LABEL: testauxs:
+define i64 @testnuxs(float %a) {
+; CHECK-LABEL: testnuxs:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtau x0, s0
+; CHECK-NEXT:    frintn s0, s0
+; CHECK-NEXT:    fcvtzu x0, s0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call float @llvm.round.f32(float %a) nounwind readnone
+  %r = call float @llvm.roundeven.f32(float %a)
   %i = call i64 @llvm.fptoui.sat.i64.f32(float %r)
   ret i64 %i
 }
 
-define i32 @testauwd(double %a) {
-; CHECK-LABEL: testauwd:
+define i32 @testnuwd(double %a) {
+; CHECK-LABEL: testnuwd:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtau w0, d0
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu w0, d0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call double @llvm.round.f64(double %a) nounwind readnone
+  %r = call double @llvm.roundeven.f64(double %a)
   %i = call i32 @llvm.fptoui.sat.i32.f64(double %r)
   ret i32 %i
 }
 
-define i64 @testauxd(double %a) {
-; CHECK-LABEL: testauxd:
+define i64 @testnuxd(double %a) {
+; CHECK-LABEL: testnuxd:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    fcvtau x0, d0
+; CHECK-NEXT:    frintn d0, d0
+; CHECK-NEXT:    fcvtzu x0, d0
 ; CHECK-NEXT:    ret
 entry:
-  %r = call double @llvm.round.f64(double %a) nounwind readnone
+  %r = call double @llvm.roundeven.f64(double %a)
   %i = call i64 @llvm.fptoui.sat.i64.f64(double %r)
   ret i64 %i
 }
-
-declare i32 @llvm.fptoui.sat.i32.f16 (half)
-declare i64 @llvm.fptoui.sat.i64.f16 (half)
-declare i32 @llvm.fptoui.sat.i32.f32 (float)
-declare i64 @llvm.fptoui.sat.i64.f32 (float)
-declare i32 @llvm.fptoui.sat.i32.f64 (double)
-declare i64 @llvm.fptoui.sat.i64.f64 (double)
-
-declare half @llvm.floor.f16(half) nounwind readnone
-declare half @llvm.ceil.f16(half) nounwind readnone
-declare half @llvm.trunc.f16(half) nounwind readnone
-declare half @llvm.round.f16(half) nounwind readnone
-declare float @llvm.floor.f32(float) nounwind readnone
-declare float @llvm.ceil.f32(float) nounwind readnone
-declare float @llvm.trunc.f32(float) nounwind readnone
-declare float @llvm.round.f32(float) nounwind readnone
-declare double @llvm.floor.f64(double) nounwind readnone
-declare double @llvm.ceil.f64(double) nounwind readnone
-declare double @llvm.trunc.f64(double) nounwind readnone
-declare double @llvm.round.f64(double) nounwind readnone


        


More information about the llvm-commits mailing list