Please review, i'll commit it, just need an OK.
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 90567df..ca92c6a 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -237,14 +237,14 @@ src_libmingwex=\
math/fmal.c math/fmax.c math/fmaxf.c math/fmaxl.c math/fmin.c math/fminf.c \
math/fminl.c math/fmodl.c math/fp_consts.c math/fp_constsf.c \
math/fp_constsl.c math/fpclassify.c math/fpclassifyf.c math/fpclassifyl.c math/frexpf.c math/fucom.c \
- math/hypotf.c math/hypotl.c math/isnan.c math/isnanf.c math/isnanl.c math/ldexp.c \
+ math/hypotf.c math/hypotl.c math/isnan.c math/isnanf.c math/isnanl.c \
math/ldexpf.c math/ldexpl.c math/lgamma.c math/lgammaf.c math/lgammal.c math/llrint.c \
math/signgam.c \
math/llrintf.c math/llrintl.c math/llround.c math/llroundf.c math/llroundl.c math/log.c \
math/log10f.c math/logbl.c math/logf.c math/logl.c \
math/lrint.c math/lrintf.c math/lrintl.c math/lround.c math/lroundf.c math/lroundl.c \
math/modf.c math/modff.c math/modfl.c math/nextafterf.c math/nextafterl.c math/nexttoward.c \
- math/nexttowardf.c math/pow.c math/powf.c math/powi.c math/powif.c math/powil.c \
+ math/nexttowardf.c math/powf.c math/powi.c math/powif.c math/powil.c \
math/powl.c math/rint.c math/rintf.c math/rintl.c math/round.c math/roundf.c \
math/roundl.c math/s_erf.c math/sf_erf.c math/signbit.c math/signbitf.c math/signbitl.c \
math/sinhf.c math/sinhl.c math/sinl.c math/sqrt.c \
@@ -300,9 +300,10 @@ src_libmingwex64=\
math/asinhf.c math/atan2f.c math/atanf.c math/atanh.c math/atanhf.c \
math/cos.c math/cosf.c math/cossin.c math/exp.c math/exp2.S \
math/exp2f.S math/expm1.c math/expm1f.c math/fmod.c math/fmodf.c \
- math/ilogb.S math/ilogbf.S math/log1p.S math/log1pf.S math/log2.S \
- math/log2f.S math/logb.c math/logbf.c math/remainder.S math/remainderf.S \
- math/scalbn.S math/scalbnf.S math/sin.c math/sinf.c math/tanf.c
+ math/ilogb.S math/ilogbf.S math/ldexp.c math/log1p.S math/log1pf.S \
+ math/log2.S math/log2f.S math/logb.c math/logbf.c math/pow.c \
+ math/remainder.S math/remainderf.S math/scalbn.S math/scalbnf.S math/sin.c \
+ math/sinf.c math/tanf.c
# these only go into the 32 bit version:
src_libmingwex32=\
@@ -310,9 +311,10 @@ src_libmingwex32=\
math/asinhf.c math/atan2f.c math/atanf.c math/atanh.c math/atanhf.c \
math/cos.c math/cosf.c math/cossin.c math/exp.c math/exp2.S \
math/exp2f.S math/expm1.c math/expm1f.c math/fmod.c math/fmodf.c \
- math/ilogb.S math/ilogbf.S math/log1p.S math/log1pf.S math/log2.S \
- math/log2f.S math/logb.c math/logbf.c math/remainder.S math/remainderf.S \
- math/scalbn.S math/scalbnf.S math/sin.c math/sinf.c math/tanf.c
+ math/ilogb.S math/ilogbf.S math/ldexp.c math/log1p.S math/log1pf.S \
+ math/log2.S math/log2f.S math/logb.c math/logbf.c math/pow.c \
+ math/remainder.S math/remainderf.S math/scalbn.S math/scalbnf.S math/sin.c \
+ math/sinf.c math/tanf.c
# these only go into the ARM32 version:
src_libmingwexarm32=\
@@ -321,10 +323,10 @@ src_libmingwexarm32=\
math/softmath/asinhf.c math/softmath/atan2f.c math/softmath/atanf.c math/softmath/atanh.c math/softmath/atanhf.c \
math/softmath/cos.c math/softmath/cosf.c math/softmath/exp.c math/softmath/exp2.c math/softmath/exp2f.c \
math/softmath/expm1.c math/softmath/expm1f.c math/softmath/fmod.c math/softmath/fmodf.c math/softmath/ilogb.c \
- math/softmath/ilogbf.c math/softmath/log1p.c math/softmath/log1pf.c math/softmath/log2.c math/softmath/log2f.c \
- math/softmath/logb.c math/softmath/logbf.c math/softmath/remainder.c math/softmath/remainderf.c math/softmath/scalbn.c \
- math/softmath/scalbnf.c math/softmath/sin.c math/softmath/sincos.c math/softmath/sincosf.c math/softmath/sinf.c \
- math/softmath/tanf.c
+ math/softmath/ilogbf.c math/softmath/ldexp.c math/softmath/log1p.c math/softmath/log1pf.c math/softmath/log2.c \
+ math/softmath/log2f.c math/softmath/logb.c math/softmath/logbf.c math/softmath/pow.c math/softmath/remainder.c \
+ math/softmath/remainderf.c math/softmath/scalbn.c math/softmath/scalbnf.c math/softmath/sin.c math/softmath/sincos.c \
+ math/softmath/sincosf.c math/softmath/sinf.c math/softmath/tanf.c
# These intrinsics are target independent:
diff --git a/mingw-w64-crt/math/fpclassify.c b/mingw-w64-crt/math/fpclassify.c
index 0a64c11..91c8b54 100644
--- a/mingw-w64-crt/math/fpclassify.c
+++ b/mingw-w64-crt/math/fpclassify.c
@@ -17,7 +17,7 @@ and sets C1 flag (signbit) if neg */
int __fpclassify (double _x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_dbl_type_t hlp;
unsigned int l, h;
@@ -32,7 +32,7 @@ int __fpclassify (double _x)
if (h == 0x7ff00000)
return (l ? FP_NAN : FP_INFINITE);
return FP_NORMAL;
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ (
"fxam; fstsw %%ax;"
diff --git a/mingw-w64-crt/math/fpclassifyf.c b/mingw-w64-crt/math/fpclassifyf.c
index 7bf88c5..93fc6b7 100644
--- a/mingw-w64-crt/math/fpclassifyf.c
+++ b/mingw-w64-crt/math/fpclassifyf.c
@@ -8,7 +8,7 @@
int __fpclassifyf (float _x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_flt_type_t hlp;
hlp.x = _x;
@@ -20,7 +20,7 @@ int __fpclassifyf (float _x)
if (hlp.val >= 0x7f800000)
return (hlp.val > 0x7f800000 ? FP_NAN : FP_INFINITE);
return FP_NORMAL;
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ (
"fxam; fstsw %%ax;"
diff --git a/mingw-w64-crt/math/fpclassifyl.c b/mingw-w64-crt/math/fpclassifyl.c
index 435aaac..258b2ec 100644
--- a/mingw-w64-crt/math/fpclassifyl.c
+++ b/mingw-w64-crt/math/fpclassifyl.c
@@ -6,7 +6,7 @@
#include <math.h>
int __fpclassifyl (long double _x){
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_)
__mingw_fp_types_t hlp;
unsigned int e;
hlp.ld = &_x;
@@ -23,7 +23,9 @@ int __fpclassifyl (long double _x){
return (((hlp.ldt->lh.high & 0x7fffffff) | hlp.ldt->lh.low) == 0 ?
FP_INFINITE : FP_NAN);
return FP_NORMAL;
-#else
+#elif defined(__arm__) || defined(_ARM_)
+ __fpclassify(_x);
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ (
"fxam; fstsw %%ax;"
diff --git a/mingw-w64-crt/math/isnan.c b/mingw-w64-crt/math/isnan.c
index 962df41..e9e18ee 100644
--- a/mingw-w64-crt/math/isnan.c
+++ b/mingw-w64-crt/math/isnan.c
@@ -8,7 +8,7 @@
int
__isnan (double _x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_dbl_type_t hlp;
int l, h;
@@ -18,7 +18,7 @@ __isnan (double _x)
h |= (unsigned int) (l | -l) >> 31;
h = 0x7ff00000 - h;
return (int) ((unsigned int) h) >> 31;
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short _sw;
__asm__ __volatile__ ("fxam;"
"fstsw %%ax": "=a" (_sw) : "t" (_x));
diff --git a/mingw-w64-crt/math/isnanf.c b/mingw-w64-crt/math/isnanf.c
index de5c854..f82277e 100644
--- a/mingw-w64-crt/math/isnanf.c
+++ b/mingw-w64-crt/math/isnanf.c
@@ -7,7 +7,7 @@
int
__isnanf (float _x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_flt_type_t hlp;
int i;
@@ -15,7 +15,7 @@ __isnanf (float _x)
i = hlp.val & 0x7fffffff;
i = 0x7f800000 - i;
return (int) (((unsigned int) i) >> 31);
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short _sw;
__asm__ __volatile__ ("fxam;"
"fstsw %%ax": "=a" (_sw) : "t" (_x) );
diff --git a/mingw-w64-crt/math/isnanl.c b/mingw-w64-crt/math/isnanl.c
index 9ce8446..197a041 100644
--- a/mingw-w64-crt/math/isnanl.c
+++ b/mingw-w64-crt/math/isnanl.c
@@ -8,7 +8,7 @@
int
__isnanl (long double _x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_)
__mingw_fp_types_t ld;
int xx, signexp;
@@ -18,7 +18,9 @@ __isnanl (long double _x)
signexp |= (unsigned int) (xx | (-xx)) >> 31;
signexp = 0xfffe - signexp;
return (int) ((unsigned int) signexp) >> 16;
-#else
+#elif defined(__arm__) || defined(_ARM_)
+ __isnan(_x);
+#elif defined(__i386__) || defined(_X86_)
unsigned short _sw;
__asm__ __volatile__ ("fxam;"
"fstsw %%ax": "=a" (_sw) : "t" (_x));
diff --git a/mingw-w64-crt/math/signbit.c b/mingw-w64-crt/math/signbit.c
index 3d4900e..5b9c8cc 100644
--- a/mingw-w64-crt/math/signbit.c
+++ b/mingw-w64-crt/math/signbit.c
@@ -16,12 +16,12 @@ typedef union __mingw_dbl_type_t {
int __signbit (double x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_dbl_type_t hlp;
hlp.x = x;
return ((hlp.lh.high & 0x80000000) != 0);
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ ("fxam; fstsw %%ax;"
: "=a" (sw)
diff --git a/mingw-w64-crt/math/signbitf.c b/mingw-w64-crt/math/signbitf.c
index 405baa1..3745862 100644
--- a/mingw-w64-crt/math/signbitf.c
+++ b/mingw-w64-crt/math/signbitf.c
@@ -13,11 +13,11 @@ typedef union __mingw_flt_type_t {
int __signbitf (float x)
{
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
__mingw_flt_type_t hlp;
hlp.x = x;
return ((hlp.val & 0x80000000) != 0);
-#else
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ ("fxam; fstsw %%ax;"
: "=a" (sw)
diff --git a/mingw-w64-crt/math/signbitl.c b/mingw-w64-crt/math/signbitl.c
index a7cb0f6..e0c29c7 100644
--- a/mingw-w64-crt/math/signbitl.c
+++ b/mingw-w64-crt/math/signbitl.c
@@ -25,11 +25,13 @@ int __signbitl (long double x);
int __signbitl (long double x) {
-#ifdef __x86_64
+#if defined(__x86_64__) || defined(_AMD64_)
__mingw_fp_types_t ld;
ld.ld = &x;
return ((ld.ldt->lh.sign_exponent & 0x8000) != 0);
-#else
+#elif defined(__arm__) || defined(_ARM_)
+ __signbit(x);
+#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ ("fxam; fstsw %%ax;"
: "=a" (sw)
diff --git a/mingw-w64-crt/math/softmath/ldexp.c b/mingw-w64-crt/math/softmath/ldexp.c
new file mode 100644
index 0000000..7c60792
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/ldexp.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2014 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "softmath_private.h"
+
+double ldexp(double x, int exp)
+{
+ return x * bsd__ieee754_pow(2, exp);
+}
diff --git a/mingw-w64-crt/math/softmath/pow.c b/mingw-w64-crt/math/softmath/pow.c
new file mode 100644
index 0000000..08f3ef0
--- /dev/null
+++ b/mingw-w64-crt/math/softmath/pow.c
@@ -0,0 +1,50 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2014 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions in source code must retain the accompanying copyright
+ notice, this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ 3. Names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission
+ from the copyright holders.
+ 4. The right to distribute this software or to use it for any purpose does
+ not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+ the copyright holders. Use of them is covered by separate agreement
+ with the copyright holders.
+ 5. If any files are modified, you must cause the modified files to carry
+ prominent notices stating that you changed the files and the date of
+ any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "softmath_private.h"
+
+double pow(double x, double y)
+{
+ return bsd__ieee754_pow(x, y);
+}
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public