ppc: add configure check for older compilers erroring on 'd' constraint
authorrofl0r <rofl0r@users.noreply.github.com>
Tue, 5 Nov 2019 21:01:42 +0000 (21:01 +0000)
committerRich Felker <dalias@aerifal.cx>
Wed, 6 Nov 2019 02:48:31 +0000 (21:48 -0500)
configure
src/math/powerpc/fabs.c
src/math/powerpc/fma.c

index 8680128..a272896 100755 (executable)
--- 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" \
index f6ec443..0efc21e 100644 (file)
@@ -1,6 +1,6 @@
 #include <math.h>
 
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
 
 #include "../fabs.c"
 
index fd268f5..135c990 100644 (file)
@@ -1,6 +1,6 @@
 #include <math.h>
 
-#ifdef _SOFT_FLOAT
+#if defined(_SOFT_FLOAT) || defined(BROKEN_PPC_D_ASM)
 
 #include "../fma.c"