[04/13] powerpc64le: Ensure correct ldouble compiler flags are used

Message ID 20200306203721.15886-5-murphyp@linux.vnet.ibm.com
State New
Headers show
Series
  • Enable IEEE binary128 long double on powerpc64le
Related show

Commit Message

Paul E. Murphy March 6, 2020, 8:37 p.m.
From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>


Ensure the correct ldouble abi flags are applied to ibm128 files and
nldbl files.  Remove the IEEE options if used, and apply the flags
used to build ldouble files which are ibm128 abi.

nldbl tests are a little tricky.  To use the support, we must remove
all ldouble abi flags, and ensure -mlong-double-64 is used.

Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
---
 sysdeps/powerpc/powerpc64/le/Makefile | 58 +++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

-- 
2.21.1

Comments

Tulio Magno Quites Machado Filho March 24, 2020, 8:32 p.m. | #1
"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>

>

> Ensure the correct ldouble abi flags are applied to ibm128 files and

> nldbl files.  Remove the IEEE options if used, and apply the flags

> used to build ldouble files which are ibm128 abi.

>

> nldbl tests are a little tricky.  To use the support, we must remove

> all ldouble abi flags, and ensure -mlong-double-64 is used.

>

> Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

> Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

> Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>


Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>


-- 
Tulio Magno
Chang S. Bae via Libc-alpha March 25, 2020, 9:21 p.m. | #2
On 3/24/20 3:32 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> 

>> From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>

>>

>> Ensure the correct ldouble abi flags are applied to ibm128 files and

>> nldbl files.  Remove the IEEE options if used, and apply the flags

>> used to build ldouble files which are ibm128 abi.

>>

>> nldbl tests are a little tricky.  To use the support, we must remove

>> all ldouble abi flags, and ensure -mlong-double-64 is used.

>>

>> Co-authored-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

>> Co-authored-by: Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

>> Co-authored-by: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

> 

> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

> 


Pushed, thank you for reviewing.

Patch

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 0ce3868c3c..480e113637 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -6,6 +6,13 @@ 
 # linked executables, forcing to link the loader after libgcc link.
 f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed
 
+# Bootstrapping code for enabling IEEE 128.  This can be removed and
+# any indirections simplified once IEEE 128 long double is enabled.
+type-ldouble-CFLAGS =
+ifeq ($(ibm128-fcts),yes)
+type-ldouble-CFLAGS += -mabi=ibmlongdouble
+endif
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
@@ -35,6 +42,42 @@  $(foreach test, \
 	  test-math-iszero, \
 	  $(objpfx)$(test)): \
   gnulib-tests += $(f128-loader-link)
+
+CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS)
+CFLAGS-s_logbl-ppc64.c += $(type-ldouble-CFLAGS)
+
+$(foreach suf,$(all-object-suffixes),\
+          $(objpfx)s_copysignl$(suf) \
+          $(objpfx)s_fabsl$(suf)): \
+  ASFLAGS += $(type-ldouble-CFLAGS)
+
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)test-narrow-macros-ldbl-64$(suf) \
+         $(objpfx)test-nldbl-redirect$(suf) \
+         $(objpfx)test-redirection-ldbl-64$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+
+endif
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+ifeq ($(subdir),misc)
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-warn$(suf) \
+         $(objpfx)tst-nldbl-error$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+endif
+
+# Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
+ifeq ($(subdir),argp)
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-argp$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -82,3 +125,18 @@  CFLAGS-printf_fp.c = -mfloat128
 CFLAGS-printf_fphex.c = -mfloat128
 CFLAGS-printf_size.c = -mfloat128
 endif
+
+
+$(foreach suf,$(all-object-suffixes),$(objpfx)nldbl-%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+ldbl-ibm128-files = $(objpfx)nldbl-%$(suf) \
+		    $(objpfx)libm-test-%ibm128$(suf) \
+		    $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf) \
+		    $(objpfx)test-tgmath3-%$(suf)
+
+# Remove -mabi=ieeelongdouble from ldbl-ibm128 files.
+$(foreach suf,$(all-object-suffixes), $(ldbl-ibm128-files)) \
+	  $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
+		    $(objpfx)$(r)$(suf)): \
+  sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))