Add mingw patches for fixing math functions

This commit is contained in:
Martin Storsjö authored and Martin Storsjo committed 2016-08-27 22:48:15 +03:00
1 parent d71fab8802
commit 0e847128ef
2 files changed
+126

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
From 7f02a5261b7c02324f035b85dc75cab03796bbb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 18 Aug 2016 14:48:26 +0300
Subject: [PATCH 1/2] Make the "softfloat" log2/log2f/exp2/exp2f call the
msvcrt log/pow functions
These work properly and won't do infinite recursion on certain values,
etc.
---
mingw-w64-crt/math/softmath/exp2.c | 4 ++--
mingw-w64-crt/math/softmath/exp2f.c | 4 ++--
mingw-w64-crt/math/softmath/log2.c | 4 ++--
mingw-w64-crt/math/softmath/log2f.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/mingw-w64-crt/math/softmath/exp2.c b/mingw-w64-crt/math/softmath/exp2.c
index 61e5955..0291d97 100644
--- a/mingw-w64-crt/math/softmath/exp2.c
+++ b/mingw-w64-crt/math/softmath/exp2.c
@@ -42,9 +42,9 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "softmath_private.h"
+#include <math.h>
double exp2(double x)
{
- return bsd__ieee754_pow(2, x);
+ return pow(2, x);
}
diff --git a/mingw-w64-crt/math/softmath/exp2f.c b/mingw-w64-crt/math/softmath/exp2f.c
index 6dee1bb..11e279d 100644
--- a/mingw-w64-crt/math/softmath/exp2f.c
+++ b/mingw-w64-crt/math/softmath/exp2f.c
@@ -42,9 +42,9 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "softmath_private.h"
+#include <math.h>
float exp2f(float x)
{
- return bsd__ieee754_powf(2, x);
+ return powf(2, x);
}
diff --git a/mingw-w64-crt/math/softmath/log2.c b/mingw-w64-crt/math/softmath/log2.c
index c35a7a3..756d8f1 100644
--- a/mingw-w64-crt/math/softmath/log2.c
+++ b/mingw-w64-crt/math/softmath/log2.c
@@ -42,9 +42,9 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "softmath_private.h"
+#include <math.h>
double log2(double x)
{
- return softmath_log(x) / 0.69314718246459960938;
+ return log(x) / 0.69314718246459960938;
}
diff --git a/mingw-w64-crt/math/softmath/log2f.c b/mingw-w64-crt/math/softmath/log2f.c
index 73d9659..055d0d4 100644
--- a/mingw-w64-crt/math/softmath/log2f.c
+++ b/mingw-w64-crt/math/softmath/log2f.c
@@ -42,9 +42,9 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "softmath_private.h"
+#include <math.h>
float log2f(float x)
{
- return softmath_logf(x) / 0.69314718246459960938f;
+ return logf(x) / 0.69314718246459960938f;
}
--
2.7.4
+44
View File
@@ -0,0 +1,44 @@
From abbcfbd82ca4b3be758ffee0234eeb5de2090434 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 23 Aug 2016 00:12:04 +0300
Subject: [PATCH 2/2] Remove unnecessary softfloat routines from libmingwex on
arm
The removed ones exist in msvcrt already (both the basic "msvcrt.dll"
and the later versioned ones).
---
mingw-w64-crt/Makefile.am | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 886fcf0..491e105 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -348,22 +348,8 @@ src_libmingwex32=\
# these only go into the ARM32 version:
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 \
- math/softmath/atan2f.c math/softmath/atan2l.c math/softmath/atanf.c math/softmath/atanh.c math/softmath/atanl.c \
- math/softmath/atanhf.c math/softmath/atanhl.c math/softmath/cos.c math/softmath/cosf.c math/softmath/cosl.c \
- math/softmath/exp.c math/softmath/expl.c math/softmath/exp2.c math/softmath/exp2f.c math/softmath/exp2l.c \
- math/softmath/expm1.c math/softmath/expm1f.c math/softmath/expm1l.c math/softmath/fmod.c math/softmath/fmodf.c \
- math/softmath/fmodl.c math/softmath/frexpl.c math/softmath/ilogb.c math/softmath/ilogbf.c math/softmath/ilogbl.c \
- math/softmath/ldexp.c math/softmath/ldexpl.c math/softmath/log.c math/softmath/log10l.c math/softmath/log1p.c \
- math/softmath/log1pf.c math/softmath/log1pl.c math/softmath/log2.c math/softmath/log2f.c math/softmath/log2l.c \
- math/softmath/logb.c math/softmath/logbf.c math/softmath/logbl.c math/softmath/logl.c math/softmath/pow.c \
- math/softmath/powl.c \
- math/softmath/remainder.c math/softmath/remainderf.c math/softmath/remainderl.c \
- math/softmath/remquo.c math/softmath/remquof.c math/softmath/remquol.c math/softmath/scalbn.c math/softmath/scalbnf.c \
- 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
+ math/softmath/exp2.c math/softmath/exp2f.c math/softmath/exp2l.c \
+ math/softmath/log2.c math/softmath/log2f.c math/softmath/log2l.c math/softmath/e_pow.c math/softmath/e_powf.c math/softmath/scalbn.c math/softmath/scalbnf.c
# These intrinsics are target independent:
--
2.7.4