[3/3] powerpc64le: Disable compiler support for float128 when reusing ldbl-128

Message ID 20170907104352.7748-4-gabriel@inconstante.eti.br
State New
Headers show
Series
  • Fixes for -mfloat128 being enabled by default on gcc for power
Related show

Commit Message

Gabriel F. T. Gomes Sept. 7, 2017, 10:43 a.m.
Some files under sysdeps/ieee754/ldbl-128ibm are able to reuse the
implementation in sysdeps/ieee754/ldbl-128 by defining _Float128 to long
double.  This relies on compiler support for _Float128 being disabled.

On powerpc, such support is currently disabled by default, however, it
will get enabled by default [1], requiring that this Makefile actively
disable compiler support for float128 for the required files.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html

Tested for powerpc64le with patched [1] and unpatched gcc.

	* sysdeps/powerpc/powerpc64le/Makefile (CFLAGS-e_expl.c)
	(CFLAGS-e_j0l.c, CFLAGS-e_j1l.c, CFLAGS-e_lgammal_r.c)
	(CFLAGS-s_cbrtl.c): New variables.
---
 sysdeps/powerpc/powerpc64le/Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Joseph Myers Sept. 7, 2017, 2:45 p.m. | #1
On Thu, 7 Sep 2017, Gabriel F. T. Gomes wrote:

> Some files under sysdeps/ieee754/ldbl-128ibm are able to reuse the
> implementation in sysdeps/ieee754/ldbl-128 by defining _Float128 to long
> double.  This relies on compiler support for _Float128 being disabled.
> 
> On powerpc, such support is currently disabled by default, however, it
> will get enabled by default [1], requiring that this Makefile actively
> disable compiler support for float128 for the required files.

I think it would be better to stop #include of ldbl-128 files from 
ldbl-128ibm.  That is, copy the relevant source files (in the case of 
e_expl.c that's actually t_expl.h) to ldbl-128ibm, with _Float128 
converted to long double and L() also expanded back to adding L suffixes.  
And, in the e_lgammal_r.c case, then eliminate the present LDBL_MANT_DIG 
conditionals from both copies.

Long term I'd like the ldbl-128 files to e.g. use f128 constant suffixes 
directly (once we can assume GCC >= 7 to build glibc), with such changes 
cleaning up the code but being incompatible with its use also for 
ldbl-128ibm.

Patch

diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index 3fd9d9a715..a1d37135e5 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -20,6 +20,19 @@  CFLAGS-test-math-issignaling.cc += -mfloat128
 CFLAGS-test-math-iszero.cc += -mfloat128
 $(objpfx)test-float128% $(objpfx)test-ifloat128% $(objpfx)test-math-iszero: \
   gnulib-tests += $(f128-loader-link)
+
+# Some files under sysdeps/ieee754/ldbl-128ibm are able to reuse the
+# implementation in sysdeps/ieee754/ldbl-128 by defining _Float128 to
+# long double.  This relies on compiler support for _Float128 being
+# disabled.  On powerpc, such support used to be disabled by default,
+# however, it will get enabled by default [1], requiring that this
+# Makefile actively disable it for the following files.
+# [1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html
+CFLAGS-e_expl.c += -mno-float128
+CFLAGS-e_j0l.c += -mno-float128
+CFLAGS-e_j1l.c += -mno-float128
+CFLAGS-e_lgammal_r.c += -mno-float128
+CFLAGS-s_cbrtl.c += -mno-float128
 endif
 
 # Append flags to string <-> _Float128 routines.