On Wed, Aug 16, 2017 at 01:46:12AM +0000, Joseph Myers wrote: > ENOPATCH
2017-08-15 Michael Meissner <meiss...@linux.vnet.ibm.com> PR libquadmath/81848 * configure.ac (powerpc*-linux*): Use attribute mode KC to create complex __float128 on PowerPC instead of attribute mode TC. * quadmth.h (__complex128): Likewise. * configure: Regenerate. * math/cbrtq.c (CBRT2): Use __float128 not long double. (CBRT4): Likewise. (CBRT2I): Likewise. (CBRT4I): Likewise. * math/j0q.c (U0): Likewise. * math/sqrtq.c (sqrtq): Don't depend on implicit conversion between __float128, instead explicitly convert the __float128 value to long double because the PowerPC does not allow __float128 and long double in the same expression. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: libquadmath/configure.ac =================================================================== --- libquadmath/configure.ac (revision 251097) +++ libquadmath/configure.ac (working copy) @@ -210,7 +210,11 @@ AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [ AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128], [GCC_TRY_COMPILE_OR_LINK([ + #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__) typedef _Complex float __attribute__((mode(TC))) __complex128; + #else + typedef _Complex float __attribute__((mode(KC))) __complex128; + #endif __float128 foo (__float128 x) { Index: libquadmath/configure =================================================================== --- libquadmath/configure (revision 251097) +++ libquadmath/configure (working copy) @@ -12516,7 +12516,11 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__) typedef _Complex float __attribute__((mode(TC))) __complex128; + #else + typedef _Complex float __attribute__((mode(KC))) __complex128; + #endif __float128 foo (__float128 x) { @@ -12563,7 +12567,11 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__) typedef _Complex float __attribute__((mode(TC))) __complex128; + #else + typedef _Complex float __attribute__((mode(KC))) __complex128; + #endif __float128 foo (__float128 x) { Index: libquadmath/quadmath.h =================================================================== --- libquadmath/quadmath.h (revision 251097) +++ libquadmath/quadmath.h (working copy) @@ -29,7 +29,11 @@ extern "C" { /* Define the complex type corresponding to __float128 ("_Complex __float128" is not allowed) */ +#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__) typedef _Complex float __attribute__((mode(TC))) __complex128; +#else +typedef _Complex float __attribute__((mode(KC))) __complex128; +#endif #ifdef __cplusplus # define __quadmath_throw throw () Index: libquadmath/math/cbrtq.c =================================================================== --- libquadmath/math/cbrtq.c (revision 251097) +++ libquadmath/math/cbrtq.c (working copy) @@ -56,10 +56,10 @@ Adapted for glibc October, 2001. #include "quadmath-imp.h" -static const long double CBRT2 = 1.259921049894873164767210607278228350570251Q; -static const long double CBRT4 = 1.587401051968199474751705639272308260391493Q; -static const long double CBRT2I = 0.7937005259840997373758528196361541301957467Q; -static const long double CBRT4I = 0.6299605249474365823836053036391141752851257Q; +static const __float128 CBRT2 = 1.259921049894873164767210607278228350570251Q; +static const __float128 CBRT4 = 1.587401051968199474751705639272308260391493Q; +static const __float128 CBRT2I = 0.7937005259840997373758528196361541301957467Q; +static const __float128 CBRT4I = 0.6299605249474365823836053036391141752851257Q; __float128 Index: libquadmath/math/j0q.c =================================================================== --- libquadmath/math/j0q.c (revision 251097) +++ libquadmath/math/j0q.c (working copy) @@ -816,7 +816,7 @@ static __float128 Y0_2D[NY0_2D + 1] = { /* 1.000000000000000000000000000000000000000E0 */ }; -static const long double U0 = -7.3804295108687225274343927948483016310862e-02Q; +static const __float128 U0 = -7.3804295108687225274343927948483016310862e-02Q; /* Bessel function of the second kind, order zero. */ Index: libquadmath/math/sqrtq.c =================================================================== --- libquadmath/math/sqrtq.c (revision 251097) +++ libquadmath/math/sqrtq.c (working copy) @@ -31,15 +31,18 @@ sqrtq (const __float128 x) return y; } -#ifdef HAVE_SQRTL - if (x <= LDBL_MAX && x >= LDBL_MIN) +#if defined(HAVE_SQRTL) { - /* Use long double result as starting point. */ - y = sqrtl ((long double) x); + long double xl = (long double)x; + if (xl <= LDBL_MAX && xl >= LDBL_MIN) + { + /* Use long double result as starting point. */ + y = sqrtl (xl); - /* One Newton iteration. */ - y -= 0.5q * (y - x / y); - return y; + /* One Newton iteration. */ + y -= 0.5q * (y - x / y); + return y; + } } #endif