crt: arm: Make nearbyint* just call rint*, with backup/restore of float environment flags Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/math/arm/nearbyint.S b/mingw-w64-crt/math/arm/nearbyint.S index dc66a97..4754d9d 100644 --- a/mingw-w64-crt/math/arm/nearbyint.S +++ b/mingw-w64-crt/math/arm/nearbyint.S
@@ -11,15 +11,8 @@ .globl __MINGW_USYMBOL(nearbyint) .def __MINGW_USYMBOL(nearbyint); .scl 2; .type 32; .endef __MINGW_USYMBOL(nearbyint): - vmov r2, r3, d0 - lsr r3, r3, #20 - bic r3, r3, #0x800 - movw r2, #0x7ff - cmp r2, r3 /* Check for INF/NAN, just return the input in those cases */ - it eq - bxeq lr - vmrs r1, fpscr - vcvtr.s32.f64 s0, d0 - vcvt.f64.s32 d0, s0 - vmsr fpscr, r1 - bx lr + push {r4, lr} + vmrs r4, fpscr + bl rint + vmsr fpscr, r4 + pop {r4, pc}
diff --git a/mingw-w64-crt/math/arm/nearbyintf.S b/mingw-w64-crt/math/arm/nearbyintf.S index b880c71..00236ce 100644 --- a/mingw-w64-crt/math/arm/nearbyintf.S +++ b/mingw-w64-crt/math/arm/nearbyintf.S
@@ -11,15 +11,8 @@ .globl __MINGW_USYMBOL(nearbyintf) .def __MINGW_USYMBOL(nearbyintf); .scl 2; .type 32; .endef __MINGW_USYMBOL(nearbyintf): - vmov r2, r3, d0 - lsr r3, r3, #20 - bic r3, r3, #0x800 - movw r2, #0x7ff - cmp r2, r3 /* Check for INF/NAN, just return the input in those cases */ - it eq - bxeq lr - vmrs r1, fpscr - vcvtr.s32.f32 s0, s0 - vcvt.f32.s32 s0, s0 - vmsr fpscr, r1 - bx lr + push {r4, lr} + vmrs r4, fpscr + bl rintf + vmsr fpscr, r4 + pop {r4, pc}
diff --git a/mingw-w64-crt/math/arm/nearbyintl.S b/mingw-w64-crt/math/arm/nearbyintl.S index bceda5e..a552d14 100644 --- a/mingw-w64-crt/math/arm/nearbyintl.S +++ b/mingw-w64-crt/math/arm/nearbyintl.S
@@ -11,15 +11,8 @@ .globl __MINGW_USYMBOL(nearbyintl) .def __MINGW_USYMBOL(nearbyintl); .scl 2; .type 32; .endef __MINGW_USYMBOL(nearbyintl): - vmov r2, r3, d0 - lsr r3, r3, #20 - bic r3, r3, #0x800 - movw r2, #0x7ff - cmp r2, r3 /* Check for INF/NAN, just return the input in those cases */ - it eq - bxeq lr - vmrs r1, fpscr - vcvtr.s32.f64 s0, d0 - vcvt.f64.s32 d0, s0 - vmsr fpscr, r1 - bx lr + push {r4, lr} + vmrs r4, fpscr + bl rintl + vmsr fpscr, r4 + pop {r4, pc}