crt: Use __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__ instead of arch checks
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
diff --git a/mingw-w64-crt/gdtoa/strtodnrp.c b/mingw-w64-crt/gdtoa/strtodnrp.c
index bc5e861..9304866 100644
--- a/mingw-w64-crt/gdtoa/strtodnrp.c
+++ b/mingw-w64-crt/gdtoa/strtodnrp.c
@@ -85,8 +85,7 @@
__mingw_strtod (const char * __restrict__ src, char ** __restrict__ endptr)
__attribute__((alias("__strtod")));
-#if !(defined(_AMD64_) || defined(__x86_64__) || \
- defined(_X86_) || defined(__i386__))
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
/* For systems other than x86, where long double == double, provide the
* long double functions as aliases to __strtod. */
diff --git a/mingw-w64-crt/gdtoa/strtopx.c b/mingw-w64-crt/gdtoa/strtopx.c
index a5bc3ec..b80a794 100644
--- a/mingw-w64-crt/gdtoa/strtopx.c
+++ b/mingw-w64-crt/gdtoa/strtopx.c
@@ -53,8 +53,19 @@
#define _4 0
#endif
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+/* For ARM, where long double == double, provide the long double function as
+ * an alias for __strtod. Do this in a separate object file from other
+ * functions, to avoid linker conflicts if object files import both 'strtold'
+ * from libucrt*.a and the object file providing '__strtod'. */
+long double __cdecl
+strtold (const char * __restrict__ src, char ** __restrict__ endptr)
+{
+ return __mingw_strtod(src, endptr);
+}
+
/* This is specific to the x86 80 bit long doubles. */
-#if defined(_AMD64_) || defined(__x86_64__) || \
+#elif defined(_AMD64_) || defined(__x86_64__) || \
defined(_X86_) || defined(__i386__)
typedef union lD {
@@ -133,14 +144,4 @@
strtold (const char * __restrict__ src, char ** __restrict__ endptr)
__attribute__((alias("__strtold")));
-#elif defined(__arm__) || defined(__aarch64__) || defined(_ARM_) || defined(_ARM64_)
-/* For ARM, where long double == double, provide the long double function as
- * an alias for __strtod. Do this in a separate object file from other
- * functions, to avoid linker conflicts if object files import both 'strtold'
- * from libucrt*.a and the object file providing '__strtod'. */
-long double __cdecl
-strtold (const char * __restrict__ src, char ** __restrict__ endptr)
-{
- return __mingw_strtod(src, endptr);
-}
#endif
diff --git a/mingw-w64-crt/math/coshl.c b/mingw-w64-crt/math/coshl.c
index c5aaa73..acc0094 100644
--- a/mingw-w64-crt/math/coshl.c
+++ b/mingw-w64-crt/math/coshl.c
@@ -5,7 +5,7 @@
*/
#include "cephes_mconf.h"
-#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
#include <math.h>
long double coshl(long double x)
diff --git a/mingw-w64-crt/math/erfl.c b/mingw-w64-crt/math/erfl.c
index 1408cf5..b1001df 100644
--- a/mingw-w64-crt/math/erfl.c
+++ b/mingw-w64-crt/math/erfl.c
@@ -108,7 +108,7 @@
long double erfl(long double x);
-#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
long double erfcl(long double x)
{
return erfc(x);
diff --git a/mingw-w64-crt/math/fabsl.c b/mingw-w64-crt/math/fabsl.c
index 1df48cf..ed97ed0 100644
--- a/mingw-w64-crt/math/fabsl.c
+++ b/mingw-w64-crt/math/fabsl.c
@@ -8,11 +8,11 @@
long double
fabsl (long double x)
{
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+ return __builtin_fabsl (x);
+#elif defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
long double res = 0.0L;
asm volatile ("fabs;" : "=t" (res) : "0" (x));
return res;
-#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
- return __builtin_fabsl (x);
#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */
}
diff --git a/mingw-w64-crt/math/fp_constsl.c b/mingw-w64-crt/math/fp_constsl.c
index 8804082..2bb00f7 100644
--- a/mingw-w64-crt/math/fp_constsl.c
+++ b/mingw-w64-crt/math/fp_constsl.c
@@ -16,7 +16,7 @@
long double nanl (const char *);
long double nanl (const char * tagp __attribute__((unused)) )
{
-#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
return nan("");
#else
return __QNANL.ldouble_val;
diff --git a/mingw-w64-crt/math/isnanl.c b/mingw-w64-crt/math/isnanl.c
index ff4ca6e..fdc2529 100644
--- a/mingw-w64-crt/math/isnanl.c
+++ b/mingw-w64-crt/math/isnanl.c
@@ -8,7 +8,9 @@
int
__isnanl (long double _x)
{
-#if defined(__x86_64__) || defined(_AMD64_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+ return __isnan(_x);
+#elif defined(__x86_64__) || defined(_AMD64_)
__mingw_ldbl_type_t ld;
int xx, signexp;
@@ -18,8 +20,6 @@
signexp |= (unsigned int) (xx | (-xx)) >> 31;
signexp = 0xfffe - signexp;
return (int) ((unsigned int) signexp) >> 16;
-#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
- return __isnan(_x);
#elif defined(__i386__) || defined(_X86_)
unsigned short _sw;
__asm__ __volatile__ ("fxam;"
diff --git a/mingw-w64-crt/math/lgammal.c b/mingw-w64-crt/math/lgammal.c
index 998c6a9..1ccf7fc 100644
--- a/mingw-w64-crt/math/lgammal.c
+++ b/mingw-w64-crt/math/lgammal.c
@@ -5,7 +5,7 @@
*/
#include "cephes_mconf.h"
-#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
double lgamma(double x);
long double lgammal(long double x)
diff --git a/mingw-w64-crt/math/sinhl.c b/mingw-w64-crt/math/sinhl.c
index aa6f0a9..fbf7edd 100644
--- a/mingw-w64-crt/math/sinhl.c
+++ b/mingw-w64-crt/math/sinhl.c
@@ -6,7 +6,7 @@
#include "cephes_mconf.h"
#include <errno.h>
-#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
#include <math.h>
long double sinhl(long double x)
diff --git a/mingw-w64-crt/math/tanhl.c b/mingw-w64-crt/math/tanhl.c
index da3fc5e..326adb2 100644
--- a/mingw-w64-crt/math/tanhl.c
+++ b/mingw-w64-crt/math/tanhl.c
@@ -8,7 +8,7 @@
#define _SET_ERRNO(x)
#endif
-#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
#include <math.h>
long double tanhl(long double x)
diff --git a/mingw-w64-crt/math/tgammal.c b/mingw-w64-crt/math/tgammal.c
index 1c7d4ea..cfd694f 100644
--- a/mingw-w64-crt/math/tgammal.c
+++ b/mingw-w64-crt/math/tgammal.c
@@ -5,7 +5,7 @@
*/
#include "cephes_mconf.h"
-#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
double tgamma(double x);
long double tgammal(long double x)
diff --git a/mingw-w64-crt/math/truncl.c b/mingw-w64-crt/math/truncl.c
index d1b2966..a28fed3 100644
--- a/mingw-w64-crt/math/truncl.c
+++ b/mingw-w64-crt/math/truncl.c
@@ -9,7 +9,7 @@
long double
truncl (long double _x)
{
-#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
+#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
return trunc(_x);
#else
long double retval = 0.0L;