The files that previously had assembly for both x86 and arm are copied
into subdirectories and the arm specific parts are removed from x86 and
vice versa.

Some of the remaining .c files in the main math directory also include
arch specific assembly. But when porting to a new architecture, they
should be easier to identify (than assembly files that do assemble,
producing a symbol but no code), either via #error directives for
unsupported architectures, or via assembler errors if trying to
implicitly build inline assembly for the wrong architecture.
---
 mingw-w64-crt/Makefile.am                 | 42 +++++++++++++++++--------------
 mingw-w64-crt/math/arm/_chgsignl.S        | 16 ++++++++++++
 mingw-w64-crt/math/arm/ceil.S             | 29 +++++++++++++++++++++
 mingw-w64-crt/math/arm/ceilf.S            | 28 +++++++++++++++++++++
 mingw-w64-crt/math/arm/ceill.S            | 28 +++++++++++++++++++++
 mingw-w64-crt/math/arm/copysignl.S        | 15 +++++++++++
 mingw-w64-crt/math/arm/floor.S            | 28 +++++++++++++++++++++
 mingw-w64-crt/math/arm/floorf.S           | 27 ++++++++++++++++++++
 mingw-w64-crt/math/arm/floorl.S           | 28 +++++++++++++++++++++
 mingw-w64-crt/math/{ => arm}/nearbyint.S  | 39 ----------------------------
 mingw-w64-crt/math/{ => arm}/nearbyintf.S | 39 ----------------------------
 mingw-w64-crt/math/{ => arm}/nearbyintl.S | 40 -----------------------------
 mingw-w64-crt/math/arm/trunc.S            | 28 +++++++++++++++++++++
 mingw-w64-crt/math/arm/truncf.S           | 28 +++++++++++++++++++++
 mingw-w64-crt/math/{ => x86}/_chgsignl.S  |  3 ---
 mingw-w64-crt/math/{ => x86}/ceil.S       | 16 ------------
 mingw-w64-crt/math/{ => x86}/ceilf.S      | 15 -----------
 mingw-w64-crt/math/{ => x86}/ceill.S      | 16 ------------
 mingw-w64-crt/math/{ => x86}/copysignl.S  |  2 --
 mingw-w64-crt/math/{ => x86}/floor.S      | 16 ------------
 mingw-w64-crt/math/{ => x86}/floorf.S     | 15 -----------
 mingw-w64-crt/math/{ => x86}/floorl.S     | 16 ------------
 mingw-w64-crt/math/{ => x86}/nearbyint.S  | 13 ----------
 mingw-w64-crt/math/{ => x86}/nearbyintf.S | 13 ----------
 mingw-w64-crt/math/{ => x86}/nearbyintl.S | 13 ----------
 mingw-w64-crt/math/{ => x86}/trunc.S      | 15 -----------
 mingw-w64-crt/math/{ => x86}/truncf.S     | 15 -----------
 27 files changed, 278 insertions(+), 305 deletions(-)
 create mode 100644 mingw-w64-crt/math/arm/_chgsignl.S
 create mode 100644 mingw-w64-crt/math/arm/ceil.S
 create mode 100644 mingw-w64-crt/math/arm/ceilf.S
 create mode 100644 mingw-w64-crt/math/arm/ceill.S
 create mode 100644 mingw-w64-crt/math/arm/copysignl.S
 create mode 100644 mingw-w64-crt/math/arm/floor.S
 create mode 100644 mingw-w64-crt/math/arm/floorf.S
 create mode 100644 mingw-w64-crt/math/arm/floorl.S
 copy mingw-w64-crt/math/{ => arm}/nearbyint.S (51%)
 copy mingw-w64-crt/math/{ => arm}/nearbyintf.S (51%)
 copy mingw-w64-crt/math/{ => arm}/nearbyintl.S (52%)
 create mode 100755 mingw-w64-crt/math/arm/trunc.S
 create mode 100755 mingw-w64-crt/math/arm/truncf.S
 rename mingw-w64-crt/math/{ => x86}/_chgsignl.S (94%)
 rename mingw-w64-crt/math/{ => x86}/ceil.S (85%)
 rename mingw-w64-crt/math/{ => x86}/ceilf.S (87%)
 rename mingw-w64-crt/math/{ => x86}/ceill.S (75%)
 rename mingw-w64-crt/math/{ => x86}/copysignl.S (94%)
 rename mingw-w64-crt/math/{ => x86}/floor.S (88%)
 rename mingw-w64-crt/math/{ => x86}/floorf.S (79%)
 rename mingw-w64-crt/math/{ => x86}/floorl.S (79%)
 rename mingw-w64-crt/math/{ => x86}/nearbyint.S (76%)
 rename mingw-w64-crt/math/{ => x86}/nearbyintf.S (77%)
 rename mingw-w64-crt/math/{ => x86}/nearbyintl.S (76%)
 rename mingw-w64-crt/math/{ => x86}/trunc.S (82%)
 rename mingw-w64-crt/math/{ => x86}/truncf.S (80%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 79a687d..f21bcd2 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -226,10 +226,6 @@ src_libmingwex=\
   gdtoa/misc.c      gdtoa/qnan.c     gdtoa/smisc.c  gdtoa/strtodg.c  
gdtoa/strtodnrp.c  gdtoa/strtof.c     \
   gdtoa/strtopx.c   gdtoa/sum.c      gdtoa/ulp.c    \
   \
-  math/_chgsignl.S      math/ceil.S        math/ceilf.S          math/ceill.S  
       math/copysignl.S     \
-  math/floor.S          math/floorf.S      math/floorl.S         \
-  math/nearbyint.S      math/nearbyintf.S  math/nearbyintl.S     \
-  math/trunc.S          math/truncf.S      \
   math/cbrt.c           \
   math/cbrtf.c          math/cbrtl.c       math/cephes_emath.c   
math/copysign.c      math/copysignf.c     \
   math/coshf.c          math/coshl.c       math/erfl.c           \
@@ -297,30 +293,38 @@ src_libmingwex=\
 
 # these go into both 32 and 64 bit x86 versions:
 src_libmingwex_x86=\
-  math/x86/acosf.c          math/x86/acosh.c          math/x86/acosl.c         
 math/x86/acosh.def.h      math/x86/acoshf.c         \
-  math/x86/acoshl.c         math/x86/asinf.c          math/x86/asinh.c         
 math/x86/asinl.c          math/x86/asinhf.c         \
-  math/x86/asinhl.c         math/x86/atan2f.c         math/x86/atan2.c         
 math/x86/atan2l.c         math/x86/atanf.c          \
-  math/x86/atanh.c          math/x86/atanl.c          math/x86/atanhf.c        
 math/x86/atanhl.c         math/x86/cos.c            \
+  math/x86/_chgsignl.S      math/x86/acosf.c          math/x86/acosh.c         
 math/x86/acosl.c          math/x86/acosh.def.h      \
+  math/x86/acoshf.c         math/x86/acoshl.c         math/x86/asinf.c         
 math/x86/asinh.c          math/x86/asinl.c          \
+  math/x86/asinhf.c         math/x86/asinhl.c         math/x86/atan2f.c        
 math/x86/atan2.c          math/x86/atan2l.c         \
+  math/x86/atanf.c          math/x86/atanh.c          math/x86/atanl.c         
 math/x86/atanhf.c         math/x86/atanhl.c         \
+  math/x86/ceil.S           math/x86/ceilf.S          math/x86/ceill.S         
 math/x86/copysignl.S      math/x86/cos.c            \
   math/x86/cos.def.h        math/x86/cosf.c           math/x86/cosl.c          
 math/x86/cosl_internal.S  math/x86/cossin.c         \
   math/x86/exp.c            math/x86/exp.def.h        math/x86/expl.c          
 math/x86/exp2.S           math/x86/exp2f.S          \
   math/x86/exp2l.S          math/x86/expm1.c          math/x86/expm1.def.h     
 math/x86/expm1f.c         math/x86/expm1l.c         \
-  math/x86/fastmath.h       math/x86/fmod.c           math/x86/fmodf.c         
 math/x86/fmodl.c          math/x86/frexpl.S         \
-  math/x86/fucom.c          math/x86/ilogb.S          math/x86/ilogbf.S        
 math/x86/ilogbl.S         math/x86/internal_logl.S  \
-  math/x86/ldexp.c          math/x86/ldexpl.c         math/x86/log.c           
 math/x86/log.def.h        math/x86/log10l.S         \
-  math/x86/log1p.S          math/x86/log1pf.S         math/x86/log1pl.S        
 math/x86/log2.S           math/x86/log2f.S          \
-  math/x86/log2l.S          math/x86/logb.c           math/x86/logbf.c         
 math/x86/logbl.c          math/x86/logl.c           \
-  math/x86/pow.c            math/x86/pow.def.h        math/x86/powl.c          
 math/x86/remainder.S      math/x86/remainderf.S     \
-  math/x86/remainderl.S     math/x86/remquo.S         math/x86/remquof.S       
 math/x86/remquol.S        math/x86/scalbn.S         \
-  math/x86/scalbnf.S        math/x86/scalbnl.S        math/x86/sin.c           
 math/x86/sin.def.h        math/x86/sinf.c           \
-  math/x86/sinl.c           math/x86/sinl_internal.S  math/x86/tanf.c          
 math/x86/tanl.S
+  math/x86/fastmath.h       math/x86/floor.S          math/x86/floorf.S        
 math/x86/floorl.S         math/x86/fmod.c           \
+  math/x86/fmodf.c          math/x86/fmodl.c          math/x86/frexpl.S        
 math/x86/fucom.c          math/x86/ilogb.S          \
+  math/x86/ilogbf.S         math/x86/ilogbl.S         math/x86/internal_logl.S 
 math/x86/ldexp.c          math/x86/ldexpl.c         \
+  math/x86/log.c            math/x86/log.def.h        math/x86/log10l.S        
 math/x86/log1p.S          math/x86/log1pf.S         \
+  math/x86/log1pl.S         math/x86/log2.S           math/x86/log2f.S         
 math/x86/log2l.S          math/x86/logb.c           \
+  math/x86/logbf.c          math/x86/logbl.c          math/x86/logl.c          
 math/x86/nearbyint.S      math/x86/nearbyintf.S     \
+  math/x86/nearbyintl.S     math/x86/pow.c            math/x86/pow.def.h       
 math/x86/powl.c           math/x86/remainder.S      \
+  math/x86/remainderf.S     math/x86/remainderl.S     math/x86/remquo.S        
 math/x86/remquof.S        math/x86/remquol.S        \
+  math/x86/scalbn.S         math/x86/scalbnf.S        math/x86/scalbnl.S       
 math/x86/sin.c            math/x86/sin.def.h        \
+  math/x86/sinf.c           math/x86/sinl.c           math/x86/sinl_internal.S 
 math/x86/tanf.c           math/x86/tanl.S           \
+  math/x86/trunc.S          math/x86/truncf.S
 
 
 src_libmingwex32=$(src_libmingwex_x86)
 src_libmingwex64=$(src_libmingwex_x86)
 
 # these only go into the ARM32 version:
-if ENABLE_SOFTMATH
 src_libmingwexarm32=\
+  math/arm/_chgsignl.S      math/arm/ceil.S           math/arm/ceilf.S         
 math/arm/ceill.S          math/arm/copysignl.S      \
+  math/arm/floor.S          math/arm/floorf.S         math/arm/floorl.S        
 math/arm/nearbyint.S      math/arm/nearbyintf.S     \
+  math/arm/nearbyintl.S     math/arm/trunc.S          math/arm/truncf.S
+
+if ENABLE_SOFTMATH
+src_libmingwexarm32+=\
   math/softmath/e_fmod.c    math/softmath/e_fmodf.c   math/softmath/e_powf.c   
 math/softmath/e_pow.c \
   math/softmath/acosf.c     math/softmath/acosh.c     math/softmath/acosl.c    
 math/softmath/acoshf.c    math/softmath/acoshl.c    \
   math/softmath/asinf.c     math/softmath/asinh.c     math/softmath/asinl.c    
 math/softmath/asinhf.c    math/softmath/asinhl.c    \
@@ -338,7 +342,7 @@ src_libmingwexarm32=\
   math/softmath/scalbnl.c   math/softmath/sin.c       math/softmath/sincos.c   
 math/softmath/sincosf.c   math/softmath/sincosl.c   \
   math/softmath/sinf.c      math/softmath/sinl.c      math/softmath/tanf.c     
 math/softmath/tanl.c
 else
-src_libmingwexarm32=\
+src_libmingwexarm32+=\
   math/arm/exp2.c           math/arm/log2.c           math/arm/scalbn.c        
 math/arm/sincos.c
 endif
 
diff --git a/mingw-w64-crt/math/arm/_chgsignl.S 
b/mingw-w64-crt/math/arm/_chgsignl.S
new file mode 100644
index 0000000..355d355
--- /dev/null
+++ b/mingw-w64-crt/math/arm/_chgsignl.S
@@ -0,0 +1,16 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include <_mingw_mac.h>
+
+       .file   "_chgignl.S"
+       .text
+       .align 4
+       .globl __MINGW_USYMBOL(_chgsignl)
+       .def    __MINGW_USYMBOL(_chgsignl);     .scl    2;      .type   32;     
.endef
+__MINGW_USYMBOL(_chgsignl):
+       vneg.f64        d0, d0
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/ceil.S b/mingw-w64-crt/math/arm/ceil.S
new file mode 100644
index 0000000..47162c9
--- /dev/null
+++ b/mingw-w64-crt/math/arm/ceil.S
@@ -0,0 +1,29 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "ceil.S"
+       .text
+       .align 4
+       .globl __MINGW_USYMBOL(ceil)
+       .def    __MINGW_USYMBOL(ceil);  .scl    2;      .type   32;     .endef
+
+__MINGW_USYMBOL(ceil):
+       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
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f64   s0, d0
+       vcvt.f64.s32    d0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/ceilf.S b/mingw-w64-crt/math/arm/ceilf.S
new file mode 100644
index 0000000..a899f25
--- /dev/null
+++ b/mingw-w64-crt/math/arm/ceilf.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "ceilf.S"
+       .text
+       .align 4
+       .globl __MINGW_USYMBOL(ceilf)
+       .def    __MINGW_USYMBOL(ceilf); .scl    2;      .type   32;     .endef
+
+__MINGW_USYMBOL(ceilf):
+       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 */
+       it              eq
+       bxeq    lr
+       vmrs    r1, fpscr
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f32   s0, s0
+       vcvt.f32.s32    s0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/ceill.S b/mingw-w64-crt/math/arm/ceill.S
new file mode 100644
index 0000000..9c6934b
--- /dev/null
+++ b/mingw-w64-crt/math/arm/ceill.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "ceill.S"
+       .text
+       .align 4
+       .globl __MINGW_USYMBOL(ceill)
+       .def    __MINGW_USYMBOL(ceill); .scl    2;      .type   32;     .endef
+__MINGW_USYMBOL(ceill):
+       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
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f64   s0, d0
+       vcvt.f64.s32    d0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/copysignl.S 
b/mingw-w64-crt/math/arm/copysignl.S
new file mode 100644
index 0000000..d58b7d1
--- /dev/null
+++ b/mingw-w64-crt/math/arm/copysignl.S
@@ -0,0 +1,15 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "copysignl.S"
+       .text
+       .align 4
+
+       .globl __MINGW_USYMBOL(copysignl)
+       .def    __MINGW_USYMBOL(copysignl);     .scl    2;      .type   32;     
.endef
+__MINGW_USYMBOL(copysignl):
+       b       copysign
diff --git a/mingw-w64-crt/math/arm/floor.S b/mingw-w64-crt/math/arm/floor.S
new file mode 100644
index 0000000..fc1df16
--- /dev/null
+++ b/mingw-w64-crt/math/arm/floor.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "floor.S"
+       .text
+       .p2align 4,,15
+       .globl __MINGW_USYMBOL(floor)
+       .def    __MINGW_USYMBOL(floor); .scl    2;      .type   32;     .endef
+__MINGW_USYMBOL(floor):
+       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
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f64   s0, d0
+       vcvt.f64.s32    d0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/floorf.S b/mingw-w64-crt/math/arm/floorf.S
new file mode 100644
index 0000000..b5ae0c7
--- /dev/null
+++ b/mingw-w64-crt/math/arm/floorf.S
@@ -0,0 +1,27 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+ #include <_mingw_mac.h>
+
+       .file   "floorf.S"
+       .text
+       .p2align 4,,15
+       .globl __MINGW_USYMBOL(floorf)
+       .def    __MINGW_USYMBOL(floorf);        .scl    2;      .type   32;     
.endef
+__MINGW_USYMBOL(floorf):
+       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 */
+       it              eq
+       bxeq    lr
+       vmrs    r1, fpscr
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f32   s0, s0
+       vcvt.f32.s32    s0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/floorl.S b/mingw-w64-crt/math/arm/floorl.S
new file mode 100644
index 0000000..ec8c005
--- /dev/null
+++ b/mingw-w64-crt/math/arm/floorl.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file   "floorl.S"
+       .text
+       .align 4
+       .globl __MINGW_USYMBOL(floorl)
+       .def    __MINGW_USYMBOL(floorl);        .scl    2;      .type   32;     
.endef
+__MINGW_USYMBOL(floorl):
+       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
+       bic             r0, r1, #0x00c00000
+       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
+       vmsr    fpscr, r0
+       vcvtr.s32.f64   s0, d0
+       vcvt.f64.s32    d0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/nearbyint.S b/mingw-w64-crt/math/arm/nearbyint.S
similarity index 51%
copy from mingw-w64-crt/math/nearbyint.S
copy to mingw-w64-crt/math/arm/nearbyint.S
index 6aa1046..dc66a97 100644
--- a/mingw-w64-crt/math/nearbyint.S
+++ b/mingw-w64-crt/math/arm/nearbyint.S
@@ -7,33 +7,10 @@
 
        .file   "nearbyint.S"
        .text
-#ifdef __x86_64__
-       .align 8
-#else
        .align 4
-#endif
        .globl __MINGW_USYMBOL(nearbyint)
        .def    __MINGW_USYMBOL(nearbyint);     .scl    2;      .type   32;     
.endef
 __MINGW_USYMBOL(nearbyint):
-#if defined(_AMD64_) || defined(__x86_64__)
-       movsd   %xmm0,-16(%rsp)
-       fldl    -16(%rsp)
-       pushq   %rax
-       pushq   %rcx
-       fnstcw  (%rsp)
-       movq    (%rsp), %rax
-       orq     $0x20, %rax
-       movq    %rax, 8(%rsp)
-       fldcw   8(%rsp)
-       frndint
-       fclex
-       fldcw   (%rsp)
-       popq    %rcx
-       popq    %rax
-       fstpl   -16(%rsp)
-       movsd   -16(%rsp),%xmm0
-       ret
-#elif defined(_ARM_) || defined(__arm__)
        vmov    r2, r3, d0
        lsr             r3, r3, #20
        bic             r3, r3, #0x800
@@ -46,19 +23,3 @@ __MINGW_USYMBOL(nearbyint):
        vcvt.f64.s32    d0, s0
        vmsr    fpscr, r1
        bx      lr
-#elif defined(_X86_) || defined(__i386__)
-       fldl    4(%esp)
-       pushl   %eax
-       pushl   %ecx
-       fnstcw  (%esp)
-       movl    (%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, 4(%esp)
-       fldcw   4(%esp)
-       frndint
-       fclex
-       fldcw   (%esp)
-       popl    %ecx
-       popl    %eax
-       ret
-#endif
diff --git a/mingw-w64-crt/math/nearbyintf.S 
b/mingw-w64-crt/math/arm/nearbyintf.S
similarity index 51%
copy from mingw-w64-crt/math/nearbyintf.S
copy to mingw-w64-crt/math/arm/nearbyintf.S
index 54f64fd..b880c71 100644
--- a/mingw-w64-crt/math/nearbyintf.S
+++ b/mingw-w64-crt/math/arm/nearbyintf.S
@@ -7,33 +7,10 @@
 
        .file   "nearbyintf.S"
        .text
-#ifdef __x86_64__
-       .align 8
-#else
        .align 4
-#endif
        .globl __MINGW_USYMBOL(nearbyintf)
        .def    __MINGW_USYMBOL(nearbyintf);    .scl    2;      .type   32;     
.endef
 __MINGW_USYMBOL(nearbyintf):
-#if defined(_AMD64_) || defined(__x86_64__)
-       movss   %xmm0,-12(%rsp)
-       flds    -12(%rsp)
-       pushq   %rax
-       pushq   %rcx
-       fnstcw  (%rsp)
-       movq    (%rsp), %rax
-       orq     $0x20, %rax
-       movq    %rax, 8(%rsp)
-       fldcw   8(%rsp)
-       frndint
-       fclex
-       fldcw   (%rsp)
-       popq    %rcx
-       popq    %rax
-       fstps   -12(%rsp)
-       movss   -12(%rsp),%xmm0
-       ret
-#elif defined(_ARM_) || defined(__arm__)
        vmov    r2, r3, d0
        lsr             r3, r3, #20
        bic             r3, r3, #0x800
@@ -46,19 +23,3 @@ __MINGW_USYMBOL(nearbyintf):
        vcvt.f32.s32    s0, s0
        vmsr    fpscr, r1
        bx      lr
-#elif defined(_X86_) || defined(__i386__)
-       flds    4(%esp)
-       pushl   %eax
-       pushl   %ecx
-       fnstcw  (%esp)
-       movl    (%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, 4(%esp)
-       fldcw   4(%esp)
-       frndint
-       fclex
-       fldcw   (%esp)
-       popl    %ecx
-       popl    %eax
-       ret
-#endif
diff --git a/mingw-w64-crt/math/nearbyintl.S 
b/mingw-w64-crt/math/arm/nearbyintl.S
similarity index 52%
copy from mingw-w64-crt/math/nearbyintl.S
copy to mingw-w64-crt/math/arm/nearbyintl.S
index f0aca0f..bceda5e 100644
--- a/mingw-w64-crt/math/nearbyintl.S
+++ b/mingw-w64-crt/math/arm/nearbyintl.S
@@ -7,34 +7,10 @@
 
        .file   "nearbyintl.S"
        .text
-#ifdef __x86_64__
-       .align 8
-#else
        .align 4
-#endif
        .globl __MINGW_USYMBOL(nearbyintl)
        .def    __MINGW_USYMBOL(nearbyintl);    .scl    2;      .type   32;     
.endef
 __MINGW_USYMBOL(nearbyintl):
-#if defined(_AMD64_) || defined(__x86_64__)
-       fldt    (%rdx)
-       movq    %rcx,%r8
-       pushq   %rax
-       pushq   %rcx
-       fnstcw  (%rsp)
-       movl    (%rsp), %eax
-       orl     $0x20, %eax
-       movl    %eax, 8(%rsp)
-       fldcw   8(%rsp)
-       frndint
-       fclex
-       fldcw   (%rsp)
-       popq    %rcx
-       popq    %rax
-       movq    %r8,%rax
-       movq    $0,8(%r8)
-       fstpt   (%r8)
-       ret
-#elif defined(_ARM_) || defined(__arm__)
        vmov    r2, r3, d0
        lsr             r3, r3, #20
        bic             r3, r3, #0x800
@@ -47,19 +23,3 @@ __MINGW_USYMBOL(nearbyintl):
        vcvt.f64.s32    d0, s0
        vmsr    fpscr, r1
        bx      lr
-#elif defined(_X86_) || defined(__i386__)
-       fldt    4(%esp)
-       pushl   %eax
-       pushl   %ecx
-       fnstcw  (%esp)
-       movl    (%esp), %eax
-       orl     $0x20, %eax
-       movl    %eax, 4(%esp)
-       fldcw   4(%esp)
-       frndint
-       fclex
-       fldcw   (%esp)
-       popl    %ecx
-       popl    %eax
-       ret
-#endif
diff --git a/mingw-w64-crt/math/arm/trunc.S b/mingw-w64-crt/math/arm/trunc.S
new file mode 100755
index 0000000..3b297cb
--- /dev/null
+++ b/mingw-w64-crt/math/arm/trunc.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+       .file "trunc.S"
+       .text
+       .p2align 4,,15
+       .globl __MINGW_USYMBOL(trunc)
+        .def    __MINGW_USYMBOL(trunc);  .scl    2;      .type   32;     .endef
+
+__MINGW_USYMBOL(trunc):
+       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
+       orr             r0, r1, #0x00c00000 /* Round towards Zero */
+       vmsr    fpscr, r0
+       vcvtr.s32.f64   s0, d0
+       vcvt.f64.s32    d0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/arm/truncf.S b/mingw-w64-crt/math/arm/truncf.S
new file mode 100755
index 0000000..9c1f0cd
--- /dev/null
+++ b/mingw-w64-crt/math/arm/truncf.S
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <_mingw_mac.h>
+
+        .file "truncf.S"
+        .text
+        .p2align 4,,15
+        .globl __MINGW_USYMBOL(truncf)
+        .def    __MINGW_USYMBOL(truncf);  .scl    2;      .type   32;     
.endef
+
+__MINGW_USYMBOL(truncf):
+       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
+       orr             r0, r1, #0x00c00000 /* Round towards Zero */
+       vmsr    fpscr, r0
+       vcvt.s32.f32    s0, s0
+       vcvt.f32.s32    s0, s0
+       vmsr    fpscr, r1
+       bx      lr
diff --git a/mingw-w64-crt/math/_chgsignl.S b/mingw-w64-crt/math/x86/_chgsignl.S
similarity index 94%
rename from mingw-w64-crt/math/_chgsignl.S
rename to mingw-w64-crt/math/x86/_chgsignl.S
index 3876465..ae601b2 100644
--- a/mingw-w64-crt/math/_chgsignl.S
+++ b/mingw-w64-crt/math/x86/_chgsignl.S
@@ -36,9 +36,6 @@ __MINGW_USYMBOL(_chgsignl):
        movq    %rdx, 8(%rcx)
        movq    %rcx, %rax
        ret
-#elif defined(_ARM_) || defined(__arm__)
-       vneg.f64        d0, d0
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        movl    12(%esp),%eax
        xorl    $0x8000,%eax
diff --git a/mingw-w64-crt/math/ceil.S b/mingw-w64-crt/math/x86/ceil.S
similarity index 85%
rename from mingw-w64-crt/math/ceil.S
rename to mingw-w64-crt/math/x86/ceil.S
index 134029c..c20343a 100644
--- a/mingw-w64-crt/math/ceil.S
+++ b/mingw-w64-crt/math/x86/ceil.S
@@ -91,22 +91,6 @@ __MINGW_USYMBOL(ceil):
 .zero:
        .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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldl    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/ceilf.S b/mingw-w64-crt/math/x86/ceilf.S
similarity index 87%
rename from mingw-w64-crt/math/ceilf.S
rename to mingw-w64-crt/math/x86/ceilf.S
index fe64149..9096dbc 100644
--- a/mingw-w64-crt/math/ceilf.S
+++ b/mingw-w64-crt/math/x86/ceilf.S
@@ -87,21 +87,6 @@ __MINGW_USYMBOL(ceilf):
         .align 4
 .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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f32   s0, s0
-       vcvt.f32.s32    s0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        flds    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/ceill.S b/mingw-w64-crt/math/x86/ceill.S
similarity index 75%
rename from mingw-w64-crt/math/ceill.S
rename to mingw-w64-crt/math/x86/ceill.S
index 724dd52..04b6093 100644
--- a/mingw-w64-crt/math/ceill.S
+++ b/mingw-w64-crt/math/x86/ceill.S
@@ -39,22 +39,6 @@ __MINGW_USYMBOL(ceill):
        movq    $0,8(%rcx)
        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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00400000 /* Round towards Plus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldt    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/copysignl.S b/mingw-w64-crt/math/x86/copysignl.S
similarity index 94%
rename from mingw-w64-crt/math/copysignl.S
rename to mingw-w64-crt/math/x86/copysignl.S
index 5194330..d38275e 100644
--- a/mingw-w64-crt/math/copysignl.S
+++ b/mingw-w64-crt/math/x86/copysignl.S
@@ -32,8 +32,6 @@ __MINGW_USYMBOL(copysignl):
        movq    %rax, 8(%rcx)
        movq    %rcx, %rax
        ret
-#elif defined(_ARM_) || defined(__arm__)
-       b       copysign
 #elif defined(_X86_) || defined(__i386__)
        movl    24(%esp),%edx
        movl    12(%esp),%eax
diff --git a/mingw-w64-crt/math/floor.S b/mingw-w64-crt/math/x86/floor.S
similarity index 88%
rename from mingw-w64-crt/math/floor.S
rename to mingw-w64-crt/math/x86/floor.S
index 5c31404..6e436a8 100644
--- a/mingw-w64-crt/math/floor.S
+++ b/mingw-w64-crt/math/x86/floor.S
@@ -143,22 +143,6 @@ __MINGW_USYMBOL(floor):
 .hugeval:
        .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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldl    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/floorf.S b/mingw-w64-crt/math/x86/floorf.S
similarity index 79%
rename from mingw-w64-crt/math/floorf.S
rename to mingw-w64-crt/math/x86/floorf.S
index 45da320..c6226f8 100644
--- a/mingw-w64-crt/math/floorf.S
+++ b/mingw-w64-crt/math/x86/floorf.S
@@ -27,21 +27,6 @@ __MINGW_USYMBOL(floorf):
         ret
         .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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f32   s0, s0
-       vcvt.f32.s32    s0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        flds    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/floorl.S b/mingw-w64-crt/math/x86/floorl.S
similarity index 79%
rename from mingw-w64-crt/math/floorl.S
rename to mingw-w64-crt/math/x86/floorl.S
index 7398743..6a08d59 100644
--- a/mingw-w64-crt/math/floorl.S
+++ b/mingw-w64-crt/math/x86/floorl.S
@@ -39,22 +39,6 @@ __MINGW_USYMBOL(floorl):
        movq    $0,8(%rcx)
        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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       bic             r0, r1, #0x00c00000
-       orr             r0, r0, #0x00800000 /* Round towards Minus Infinity */
-       vmsr    fpscr, r0
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldt    4(%esp)
        subl    $8,%esp
diff --git a/mingw-w64-crt/math/nearbyint.S b/mingw-w64-crt/math/x86/nearbyint.S
similarity index 76%
rename from mingw-w64-crt/math/nearbyint.S
rename to mingw-w64-crt/math/x86/nearbyint.S
index 6aa1046..a0a8534 100644
--- a/mingw-w64-crt/math/nearbyint.S
+++ b/mingw-w64-crt/math/x86/nearbyint.S
@@ -33,19 +33,6 @@ __MINGW_USYMBOL(nearbyint):
        fstpl   -16(%rsp)
        movsd   -16(%rsp),%xmm0
        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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldl    4(%esp)
        pushl   %eax
diff --git a/mingw-w64-crt/math/nearbyintf.S 
b/mingw-w64-crt/math/x86/nearbyintf.S
similarity index 77%
rename from mingw-w64-crt/math/nearbyintf.S
rename to mingw-w64-crt/math/x86/nearbyintf.S
index 54f64fd..4be7124 100644
--- a/mingw-w64-crt/math/nearbyintf.S
+++ b/mingw-w64-crt/math/x86/nearbyintf.S
@@ -33,19 +33,6 @@ __MINGW_USYMBOL(nearbyintf):
        fstps   -12(%rsp)
        movss   -12(%rsp),%xmm0
        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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       vcvtr.s32.f32   s0, s0
-       vcvt.f32.s32    s0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        flds    4(%esp)
        pushl   %eax
diff --git a/mingw-w64-crt/math/nearbyintl.S 
b/mingw-w64-crt/math/x86/nearbyintl.S
similarity index 76%
rename from mingw-w64-crt/math/nearbyintl.S
rename to mingw-w64-crt/math/x86/nearbyintl.S
index f0aca0f..3882534 100644
--- a/mingw-w64-crt/math/nearbyintl.S
+++ b/mingw-w64-crt/math/x86/nearbyintl.S
@@ -34,19 +34,6 @@ __MINGW_USYMBOL(nearbyintl):
        movq    $0,8(%r8)
        fstpt   (%r8)
        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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldt    4(%esp)
        pushl   %eax
diff --git a/mingw-w64-crt/math/trunc.S b/mingw-w64-crt/math/x86/trunc.S
similarity index 82%
rename from mingw-w64-crt/math/trunc.S
rename to mingw-w64-crt/math/x86/trunc.S
index d2fca29..4f1fa2b 100755
--- a/mingw-w64-crt/math/trunc.S
+++ b/mingw-w64-crt/math/x86/trunc.S
@@ -75,21 +75,6 @@ __MINGW_USYMBOL(trunc):
        addq    $24, %rsp
        ret
        .seh_endproc
-#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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       orr             r0, r1, #0x00c00000 /* Round towards Zero */
-       vmsr    fpscr, r0
-       vcvtr.s32.f64   s0, d0
-       vcvt.f64.s32    d0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
        fldl    4(%esp)
        subl    $8, %esp
diff --git a/mingw-w64-crt/math/truncf.S b/mingw-w64-crt/math/x86/truncf.S
similarity index 80%
rename from mingw-w64-crt/math/truncf.S
rename to mingw-w64-crt/math/x86/truncf.S
index 626b9a5..40a3a6e 100755
--- a/mingw-w64-crt/math/truncf.S
+++ b/mingw-w64-crt/math/x86/truncf.S
@@ -55,21 +55,6 @@ __MINGW_USYMBOL(truncf):
        addq    $24, %rsp
        ret
        .seh_endproc
-#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 */
-       it              eq
-       bxeq    lr
-       vmrs    r1, fpscr
-       orr             r0, r1, #0x00c00000 /* Round towards Zero */
-       vmsr    fpscr, r0
-       vcvt.s32.f32    s0, s0
-       vcvt.f32.s32    s0, s0
-       vmsr    fpscr, r1
-       bx      lr
 #elif defined(_X86_) || defined(__i386__)
         flds    4(%esp)
         subl    $8, %esp
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to