---
The indentation probably looks wonky in ths patch, but I'm trying
to match the style of the rest of the arm assembly below, which
uses tabs, equal to 4 spaces.
This probably also should be done to a lot of other math functions,
but I only ran into this as an issue with floor, in the libav testsuite.
---
mingw-w64-crt/math/ceil.S | 7 +++++++
mingw-w64-crt/math/ceilf.S | 6 ++++++
mingw-w64-crt/math/ceill.S | 7 +++++++
mingw-w64-crt/math/floor.S | 7 +++++++
mingw-w64-crt/math/floorf.S | 6 ++++++
mingw-w64-crt/math/floorl.S | 7 +++++++
6 files changed, 40 insertions(+)
diff --git a/mingw-w64-crt/math/ceil.S b/mingw-w64-crt/math/ceil.S
index 2ce21dd..bb8a6e9 100644
--- a/mingw-w64-crt/math/ceil.S
+++ b/mingw-w64-crt/math/ceil.S
@@ -92,6 +92,12 @@ __MINGW_USYMBOL(ceil):
.long 0
.long 0
#elif defined(_ARM_) || defined(__arm__)
+ 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 */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
@@ -99,6 +105,7 @@ __MINGW_USYMBOL(ceil):
vcvtr.s32.f64 s0, d0
vcvt.f64.s32 d0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
fldl 4(%esp)
diff --git a/mingw-w64-crt/math/ceilf.S b/mingw-w64-crt/math/ceilf.S
index c1202e0..def516e 100644
--- a/mingw-w64-crt/math/ceilf.S
+++ b/mingw-w64-crt/math/ceilf.S
@@ -88,6 +88,11 @@ __MINGW_USYMBOL(ceilf):
.zeroval:
.long 0
#elif defined(_ARM_) || defined(__arm__)
+ vmov r2, s0
+ lsr r2, r2, #23
+ bic r2, r2, #0x100
+ cmp r2, #0xff /* Check for INF/NAN, just return the input
in those cases */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
@@ -95,6 +100,7 @@ __MINGW_USYMBOL(ceilf):
vcvt.s32.f32 s0, s0
vcvt.f32.s32 s0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
flds 4(%esp)
diff --git a/mingw-w64-crt/math/ceill.S b/mingw-w64-crt/math/ceill.S
index 9804004..39c5875 100644
--- a/mingw-w64-crt/math/ceill.S
+++ b/mingw-w64-crt/math/ceill.S
@@ -40,6 +40,12 @@ __MINGW_USYMBOL(ceill):
fstpt (%rcx)
ret
#elif defined(_ARM_) || defined(__arm__)
+ 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 */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00400000 /* Round towards Plus Infinity */
@@ -47,6 +53,7 @@ __MINGW_USYMBOL(ceill):
vcvtr.s32.f64 s0, d0
vcvt.f64.s32 d0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
fldt 4(%esp)
diff --git a/mingw-w64-crt/math/floor.S b/mingw-w64-crt/math/floor.S
index 6f4aba1..726590c 100644
--- a/mingw-w64-crt/math/floor.S
+++ b/mingw-w64-crt/math/floor.S
@@ -144,6 +144,12 @@ __MINGW_USYMBOL(floor):
.long -2013235812
.long 2117592124
#elif defined(_ARM_) || defined(__arm__)
+ 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 */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00800000 /* Round towards Minus Infinity */
@@ -151,6 +157,7 @@ __MINGW_USYMBOL(floor):
vcvtr.s32.f64 s0, d0
vcvt.f64.s32 d0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
fldl 4(%esp)
diff --git a/mingw-w64-crt/math/floorf.S b/mingw-w64-crt/math/floorf.S
index d1b16ab..94efa2a 100644
--- a/mingw-w64-crt/math/floorf.S
+++ b/mingw-w64-crt/math/floorf.S
@@ -28,6 +28,11 @@ __MINGW_USYMBOL(floorf):
.seh_endproc
.def __MINGW_USYMBOL(floor); .scl 2; .type 32; .endef
#elif defined(_ARM_) || defined(__arm__)
+ vmov r2, s0
+ lsr r2, r2, #23
+ bic r2, r2, #0x100
+ cmp r2, #0xff /* Check for INF/NAN, just return the input
in those cases */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00800000 /* Round towards Minus Infinity */
@@ -35,6 +40,7 @@ __MINGW_USYMBOL(floorf):
vcvt.s32.f32 s0, s0
vcvt.f32.s32 s0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
flds 4(%esp)
diff --git a/mingw-w64-crt/math/floorl.S b/mingw-w64-crt/math/floorl.S
index 45c50f1..ffc9ad5 100644
--- a/mingw-w64-crt/math/floorl.S
+++ b/mingw-w64-crt/math/floorl.S
@@ -40,6 +40,12 @@ __MINGW_USYMBOL(floorl):
fstpt (%rcx)
ret
#elif defined(_ARM_) || defined(__arm__)
+ 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 */
+ beq 2f
vmrs r1, fpscr
bic r0, r1, #0x00c00000
orr r0, r0, #0x00800000 /* Round towards Minus Infinity */
@@ -47,6 +53,7 @@ __MINGW_USYMBOL(floorl):
vcvtr.s32.f64 s0, d0
vcvt.f64.s32 d0, s0
vmsr fpscr, r1
+2:
bx lr
#elif defined(_X86_) || defined(__i386__)
fldt 4(%esp)
--
2.7.4
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public