summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2019-11-05 21:01:42 +0000
committerRich Felker <dalias@aerifal.cx>2019-11-05 21:48:31 -0500
commit66d1e31292a8c05d172872fe73880ca6d3b68104 (patch)
treefb0a033ae7cb48b39fc050b9c0def730bb4e6953
parent90251cf73dfdd44e7a3f085d236e89a7dff1b00b (diff)
downloadmusl-66d1e31292a8c05d172872fe73880ca6d3b68104.tar.gz
ppc: add configure check for older compilers erroring on 'd' constraint
-rwxr-xr-xconfigure9
-rw-r--r--src/math/powerpc/fabs.c2
-rw-r--r--src/math/powerpc/fma.c2
3 files changed, 11 insertions, 2 deletions
diff --git a/configure b/configure
index 86801281..a2728969 100755
--- a/configure
+++ b/configure
@@ -646,6 +646,15 @@ if test "$ARCH" = "powerpc" ; then
trycppif "__NO_FPRS__ && !_SOFT_FLOAT" "$t" && fail \
"$0: error: compiler's floating point configuration is unsupported"
trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf
+printf "checking whether compiler can use 'd' constraint in asm... "
+echo 'double f(double x) { __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); return x; }' > "$tmpc"
+if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+printf "yes\n"
+else
+printf "no\n"
+CFLAGS_AUTO="$CFLAGS_AUTO -DBROKEN_PPC_D_ASM"
+CFLAGS_AUTO="${CFLAGS_AUTO# }"
+fi
fi
test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
diff --git a/src/math/powerpc/fabs.c b/src/math/powerpc/fabs.c
index f6ec4433..0efc21ef 100644
--- a/src/math/powerpc/fabs.c
+++ b/src/math/powerpc/fabs.c
@@ -1,6 +1,6 @@
#include <math.h>
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
#include "../fabs.c"
diff --git a/src/math/powerpc/fma.c b/src/math/powerpc/fma.c
index fd268f5f..135c9903 100644
--- a/src/math/powerpc/fma.c
+++ b/src/math/powerpc/fma.c
@@ -1,6 +1,6 @@
#include <math.h>
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
#include "../fma.c"