unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Remaining ldbl-128ibm-compat support
@ 2020-02-14 16:10 Paul E. Murphy
  2020-02-14 16:10 ` [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions Paul E. Murphy
                   ` (6 more replies)
  0 siblings, 7 replies; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

This patch series contains the outstanding work
to support the IEEE 128 long double redirects from
within ldbl-128ibm-compat.

In conjunction with with the remaining patches on
the mailing list:

 <https://sourceware.org/ml/libc-alpha/2020-02/msg00401.html>

 and the remaing 5 header patches below

 <https://sourceware.org/ml/libc-alpha/2020-02/msg00049.html>

This should complete the backing support for the long
double redirects.  A final set of patches will enable the
redirects for ppc64le.  There is still more arch specific
Makefile wrangling to build this subdir.

Patches 1,3,5 are straightforward enablement.

Patch 2 enables the nexttoward/nextafterl redirects.  It is
nearly trivial, but fixes up some ldbl-128 files to use the
_Float128 name instead of 'long double' to promote reuse.

Patch 4 touches common math Makefile to support testing the
ibm128 type similar to other types.  It also modifies the
test-<type>.h to choose correct ULPs when redirects are
being used.

Patch 6 updates the ldbl-128ibm Makefile to support adding
extra compiler flags, primarily -mabi=ibmlongdouble.  It
also happened to be sitting between Patch 5 and 7.

Patch 7 allows using the redirects with libc while also
avoiding internal PLT usage.  This is kind of ugly, and I
would appreciate feedback on whether this approach is
acceptable, and if so, whether the macros are located in
the most suitable places.

Gabriel F. T. Gomes (1):
  ldbl-128ibm-compat: Provide nexttoward functions

Paul E. Murphy (4):
  ldbl-128ibm-compat: enforce correct abi flags on internal file
  ldbl-128ibm-compat: fixup subdir location of several funcs
  ldbl-128ibm-compat: enforce ibm128 on compat tests
  RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects
    internally

Rajalakshmi Srinivasaraghavan (1):
  ldbl-128ibm-compat: Add tests for IBM long double functions

Tulio Magno Quites Machado Filho (1):
  ldbl-128ibm: Let long double files have specific compiler flags

 include/err.h                                 | 12 ++---
 include/stdio.h                               | 51 ++++++++++++------
 include/sys/cdefs.h                           | 23 ++++++++
 include/sys/syslog.h                          |  2 +-
 include/wchar.h                               |  2 +-
 math/Makefile                                 |  7 ++-
 math/test-float128.h                          |  2 +-
 math/test-float64x.h                          |  2 +-
 math/test-ibm128.h                            | 19 +++++++
 math/test-ldouble.h                           |  6 +++
 sysdeps/ieee754/ldbl-128/s_nexttoward.c       |  4 +-
 sysdeps/ieee754/ldbl-128/s_nexttowardf.c      |  4 +-
 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 ++
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile   | 53 +++++++++++++------
 sysdeps/ieee754/ldbl-128ibm-compat/Versions   |  3 ++
 .../ldbl-128ibm-compat/ieee128-asprintf.c     |  5 +-
 .../ldbl-128ibm-compat/ieee128-dprintf.c      |  1 +
 .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |  7 +++
 .../ldbl-128ibm-compat/ieee128-fprintf.c      |  1 +
 .../ieee128-isoc99_sscanf.c                   |  1 +
 .../ieee128-isoc99_vfscanf.c                  |  2 +
 .../ieee128-isoc99_vsscanf.c                  |  1 +
 .../ldbl-128ibm-compat/ieee128-sprintf.c      |  1 +
 .../ldbl-128ibm-compat/ieee128-syslog.c       |  1 +
 .../ldbl-128ibm-compat/ieee128-vfprintf.c     |  1 +
 .../ldbl-128ibm-compat/s_nextafterf128.c      | 20 +++++++
 .../ldbl-128ibm-compat/s_nexttowardf128.c     | 38 +++++++++++++
 sysdeps/ieee754/ldbl-128ibm/Makefile          | 22 ++++++--
 .../ldbl-128ibm/include/bits/iscanonical.h    |  2 +-
 sysdeps/powerpc/powerpc64/le/Makefile         | 50 ++++++++++++++---
 30 files changed, 288 insertions(+), 58 deletions(-)
 create mode 100644 math/test-ibm128.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c

-- 
2.21.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-27 20:16   ` Tulio Magno Quites Machado Filho
  2020-02-14 16:10 ` [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file Paul E. Murphy
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

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

The functions in the nexttoward family are special, in the sense that
they always have a long double argument, regardless of their suffix
(i.e.: nexttowardf and nexttoward have a long double argument, besides
the float and double arguments).

On top of that, they are also special because nexttoward functions are
not part of the _FloatN API, hence __nexttowardf128 do not exist.

This patch adds 4 new function implementations for the new long double
format:

  __nexttoward_to_ieee128
  __nexttowardf_to_ieee128
  __nexttowardieee128 (as an alias to __nextafterieee128)

Likewise, rename "long double" "_Float128" in shared ldbl-128
files to ensure correct type is used irrespective of ABI
switches.

Thank you to those who helped out with this patch:

 Gabriel F. T. Gomes  <gabriel@inconstante.eti.br>
 Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
---
 sysdeps/ieee754/ldbl-128/s_nexttoward.c       |  4 +-
 sysdeps/ieee754/ldbl-128/s_nexttowardf.c      |  4 +-
 sysdeps/ieee754/ldbl-128ibm-compat/Versions   |  3 ++
 .../ldbl-128ibm-compat/s_nextafterf128.c      | 20 ++++++++++
 .../ldbl-128ibm-compat/s_nexttowardf128.c     | 38 +++++++++++++++++++
 5 files changed, 65 insertions(+), 4 deletions(-)
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c

diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
index 6db8b7f15f..e8c25f51b7 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
@@ -31,7 +31,7 @@ static char rcsid[] = "$NetBSD: $";
 #include <math_private.h>
 #include <float.h>
 
-double __nexttoward(double x, long double y)
+double __nexttoward(double x, _Float128 y)
 {
 	int32_t hx,ix;
 	int64_t hy,iy;
@@ -47,7 +47,7 @@ double __nexttoward(double x, long double y)
 	   ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0))
 							    /* y is nan */
 	   return x+y;
-	if((long double) x==y) return y;	/* x=y, return y */
+	if((_Float128) x==y) return y;		/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
 	    double u;
 	    INSERT_WORDS(x,(uint32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
index 7840cb382e..7770c4256d 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
@@ -23,7 +23,7 @@ static char rcsid[] = "$NetBSD: $";
 #include <math-barriers.h>
 #include <math_private.h>
 
-float __nexttowardf(float x, long double y)
+float __nexttowardf(float x, _Float128 y)
 {
 	int32_t hx,ix;
 	int64_t hy,iy;
@@ -38,7 +38,7 @@ float __nexttowardf(float x, long double y)
 	   ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0))
 				/* y is nan */
 	   return x+y;
-	if((long double) x==y) return y;	/* x=y, return y */
+	if((_Float128) x==y) return y;		/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
 	    float u;
 	    SET_FLOAT_WORD(x,(uint32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index 7224e1ddc7..07e6a5b08a 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -91,6 +91,9 @@ libm {
     __nearbyintieee128;
     __nextafterieee128;
     __nextdownieee128;
+    __nexttowardf_to_ieee128;
+    __nexttowardieee128;
+    __nexttoward_to_ieee128;
     __nextupieee128;
     __powieee128;
     __remainderieee128;
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
new file mode 100644
index 0000000000..cc30ae02d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
@@ -0,0 +1,20 @@
+/* Provide nexttowardl and nextafterl implementations for IEEE long double.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#include "../float128/s_nextafterf128.c"
+
+strong_alias (__nextafterieee128, __nexttowardieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c
new file mode 100644
index 0000000000..0b4204cf64
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c
@@ -0,0 +1,38 @@
+/* Provide nexttoward[|f] implementations for IEEE long double.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <float128_private.h>
+
+/* Build nexttoward functions with binary128 format.  */
+#undef weak_alias
+#define weak_alias(from, to)
+#undef libm_alias_ldouble
+#define libm_alias_ldouble(from, to)
+#undef __nexttoward
+#define __nexttoward __nexttoward_to_ieee128
+#include <sysdeps/ieee754/ldbl-128/s_nexttoward.c>
+
+#undef weak_alias
+#define weak_alias(from, to)
+#undef libm_alias_ldouble
+#define libm_alias_ldouble(from, to)
+#undef __nexttowardf
+#define __nexttowardf __nexttowardf_to_ieee128
+#include <sysdeps/ieee754/ldbl-128/s_nexttowardf.c>
+
+#include <libm-alias-ldouble.h>
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
  2020-02-14 16:10 ` [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-21 14:35   ` Paul E Murphy
  2020-02-14 16:10 ` [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions Paul E. Murphy
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

A number of utility files and helper objects should also be
explicitly configured to build with the ibm128 ABI to prevent
gremlins when enabling IEEE long double.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 7efbd00089..2dceb658e7 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -338,6 +338,17 @@ ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
 		     $(objpfx)iovswscanf^ \
 		     $(objpfx)iovfscanf^ \
 		     $(objpfx)iovfwscanf^ \
+		     $(objpfx)mpn2ldbl^ \
+		     $(objpfx)ldbl2mpn^ \
+		     $(objpfx)strtold_nan^ \
+		     $(objpfx)strtold_l^ \
+		     $(objpfx)strtold^ \
+		     $(objpfx)strfroml^ \
+		     $(objpfx)wcstold_nan^ \
+		     $(objpfx)wcstold_l^ \
+		     $(objpfx)wcstold^ \
+		     $(objpfx)printf_fphex^ \
+		     $(objpfx)printf_fp^ \
 		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
 		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
 obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
  2020-02-14 16:10 ` [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions Paul E. Murphy
  2020-02-14 16:10 ` [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-14 17:31   ` Joseph Myers
  2020-02-14 16:10 ` [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs Paul E. Murphy
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>

This patch creates test-ibm128* tests from the long double function tests.
In order to explicitly test IBM long double functions -mabi=ibmlongdouble is
added to CFLAGS.

Likewise, update the test headers to correct choose ULPs when redirects
are enabled.

Additional work-credits to:

 Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
---
 math/Makefile                                 |  7 ++-
 math/test-float128.h                          |  2 +-
 math/test-float64x.h                          |  2 +-
 math/test-ibm128.h                            | 19 +++++++
 math/test-ldouble.h                           |  6 +++
 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 ++
 sysdeps/powerpc/powerpc64/le/Makefile         | 50 ++++++++++++++++---
 7 files changed, 80 insertions(+), 9 deletions(-)
 create mode 100644 math/test-ibm128.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig

diff --git a/math/Makefile b/math/Makefile
index 1d203e7ad5..84a8b94c74 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -145,10 +145,15 @@ type-float128-yes := float128
 # _Float64x may be supported, only as an alias type.
 type-float64x-yes := float64x
 
+# IBM long double support in additional to IEEE 128 long double support
+type-ibm128-suffix := l
+type-ibm128-yes := ibm128
+
 types = $(types-basic) $(type-float128-$(float128-fcts))
 test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
 	     float32 float64 $(type-float128-$(float128-alias-fcts)) \
-	     float32x $(type-float64x-$(float64x-alias-fcts))
+	     float32x $(type-float64x-$(float64x-alias-fcts)) \
+	     $(type-ibm128-$(ibm128-fcts))
 
 # Pairs of types for which narrowing functions should be tested (this
 # variable has more entries than libm-narrow-types because it includes
diff --git a/math/test-float128.h b/math/test-float128.h
index 8f9eec14aa..07945a090b 100644
--- a/math/test-float128.h
+++ b/math/test-float128.h
@@ -28,7 +28,7 @@
 #define CFLOAT __CFLOAT128
 #define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag)))
 #define PREFIX FLT128
-#if FLT128_MANT_DIG == LDBL_MANT_DIG
+#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT128_MANT_DIG == LDBL_MANT_DIG
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
 # define ULP_I_IDX ULP_I_LDBL
diff --git a/math/test-float64x.h b/math/test-float64x.h
index 9543238209..f8e7ef2f66 100644
--- a/math/test-float64x.h
+++ b/math/test-float64x.h
@@ -28,7 +28,7 @@
 #define CFLOAT __CFLOAT64X
 #define BUILD_COMPLEX(real, imag) (CMPLXF64X ((real), (imag)))
 #define PREFIX FLT64X
-#if FLT64X_MANT_DIG == LDBL_MANT_DIG
+#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT64X_MANT_DIG == LDBL_MANT_DIG
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
 # define ULP_I_IDX ULP_I_LDBL
diff --git a/math/test-ibm128.h b/math/test-ibm128.h
new file mode 100644
index 0000000000..cd67fd1493
--- /dev/null
+++ b/math/test-ibm128.h
@@ -0,0 +1,19 @@
+/* Common definitions for libm tests for ibm long double.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "test-ldouble.h"
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 17c526bd71..c0a7a94cc1 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -27,6 +27,12 @@
 # define TYPE_STR "double"
 # define ULP_IDX ULP_DBL
 # define ULP_I_IDX ULP_I_DBL
+#elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# define TYPE_STR "float128"
+# define ULP_IDX ULP_FLT128
+# define ULP_I_IDX ULP_I_FLT128
+/* _Float128 unconditionally redirects to lgamma. Ensure the ULPs do too. */
+# define gamma lgamma
 #else
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
new file mode 100644
index 0000000000..997f632319
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
@@ -0,0 +1,3 @@
+# Include this earlier so it can be used earlier in Makefiles,
+# and sysdep/ makefiles.
+ibm128-fcts = yes
diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 0ce3868c3c..1594f6b179 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
@@ -28,13 +35,34 @@ CFLAGS-test-math-iscanonical.cc += -mfloat128
 CFLAGS-test-math-iseqsig.cc += -mfloat128
 CFLAGS-test-math-issignaling.cc += -mfloat128
 CFLAGS-test-math-iszero.cc += -mfloat128
-$(foreach test, \
-	  test-float128% test-ifloat128% test-float64x% test-ifloat64x% \
-	  $(foreach pair,$(f128-pairs),test-$(pair)%) \
-	  test-math-iscanonical test-math-iseqsig test-math-issignaling \
-	  test-math-iszero, \
-	  $(objpfx)$(test)): \
+$(foreach test,\
+	  basic-test \
+	  bug-nextafter \
+	  bug-nexttoward \
+	  test-fenv-clear \
+	  test-iszero-excess-precision \
+	  test-math-iscanonical \
+	  test-math-iseqsig \
+	  test-math-issignaling \
+	  test-math-iszero \
+	  test-misc \
+	  test-nan-overflow \
+	  test-nan-payload \
+	  test-snan \
+	  test-tgmath \
+	  test-tgmath2 \
+	  tst-CMPLX2 \
+	  test-%-ldbl-128ibm \
+	  test-ldouble% test-ildouble% \
+	  test-float128% test-ifloat128% \
+	  test-float64x% test-ifloat64x% \
+	  ,$(objpfx)$(test)): \
   gnulib-tests += $(f128-loader-link)
+
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -82,3 +110,13 @@ CFLAGS-printf_fp.c = -mfloat128
 CFLAGS-printf_fphex.c = -mfloat128
 CFLAGS-printf_size.c = -mfloat128
 endif
+
+$(foreach suf,$(all-object-suffixes),nldbl-%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble \
+    -Wno-psabi, $(sysdep-CFLAGS))
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
                   ` (2 preceding siblings ...)
  2020-02-14 16:10 ` [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-21 14:34   ` Paul E Murphy
  2020-02-14 16:10 ` [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests Paul E. Murphy
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

We want to ensure that if a second file is built to support
ieee128 long double, we built it's companion implementation
with ibm128 long double.  The shared object versions of these
files build correctly because the aliasing is sufficiently
complex to prevent the redirects from applying when defining
them.

However, this does not prevent the static object variants
from becoming quietly broken due to redirects.  This is
intentionally avoided by marking such objects to be built
with -mabi=ibmlongdouble.

Shuffle the misplaced routines to build against the subdir
which defines the needed symbols.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 32 ++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 2dceb658e7..e40ae08469 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -1,9 +1,21 @@
 ifeq ($(subdir),libio)
 ldbl-extra-routines += fwscanf \
+		       fwprintf \
+		       obprintf \
 		       swscanf \
+		       swprintf \
 		       wscanf \
+		       vasprintf \
+		       vdprintf \
+		       vscanf \
+		       vsprintf \
+		       vsnprintf \
+		       vsscanf \
+		       vswprintf \
 		       vswscanf \
-		       vwscanf
+		       vwprintf \
+		       vwscanf \
+		       wprintf
 endif
 
 ifeq ($(subdir),wcsmbs)
@@ -29,28 +41,14 @@ ldbl-extra-routines += printf_size \
 		       printf \
 		       snprintf \
 		       sprintf \
-		       vasprintf \
-		       vdprintf \
 		       vfprintf \
 		       vprintf \
-		       vsnprintf \
-		       vsprintf \
-		       fwprintf \
-		       swprintf \
-		       wprintf \
 		       vfwprintf \
-		       vswprintf \
-		       vwprintf \
 		       fscanf \
 		       scanf \
 		       sscanf \
 		       vfscanf \
-		       vscanf \
-		       vsscanf \
 		       vfwscanf \
-		       obprintf \
-		       obstack_chk \
-		       vobstack_chk \
 		       isoc99_fscanf \
 		       isoc99_scanf \
 		       isoc99_sscanf \
@@ -211,7 +209,9 @@ ldbl-extra-routines += asprintf_chk \
 		       wprintf_chk \
 		       vfwprintf_chk \
 		       vswprintf_chk \
-		       vwprintf_chk
+		       vwprintf_chk \
+		       obstack_chk \
+		       vobstack_chk
 
 tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
 CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
                   ` (3 preceding siblings ...)
  2020-02-14 16:10 ` [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-27 20:39   ` Tulio Magno Quites Machado Filho
  2020-02-14 16:10 ` [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags Paul E. Murphy
  2020-02-14 16:10 ` [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

For lack of a more comprehensive solution, tack on the ibm128 ABI
compiler options for the totalorder{,mag}l compat tests which exist
prior to enabling this feature.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index e40ae08469..af8027cf0e 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -270,6 +270,7 @@ tests-internal += tst-ibm128-error tst-ieee128-error
 tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
 
 $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
+$(objpfx)tst-ldbl-efgcvt: gnulib-tests += $(f128-loader-link)
 
 $(objpfx)tst-ibm128-%.c: tst-ldbl-%.c
 	cp $< $@
@@ -318,6 +319,15 @@ CFLAGS-test-strfrom-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
 $(objpfx)test-strfrom-ieee128: gnulib-tests += $(f128-loader-link)
 endif
 
+ifeq ($(subdir),math)
+# The totalorder{,mag} compatibility tests were added prior to this
+# support. Thus, they can only correctly be used with ibm128.
+CFLAGS-test-ldouble-compat_totalorder.c += -mabi=ibmlongdouble
+CFLAGS-test-ldouble-compat_totalordermag.c += -mabi=ibmlongdouble
+CFLAGS-test-ildouble-compat_totalorder.c += -mabi=ibmlongdouble
+CFLAGS-test-ildouble-compat_totalordermag.c += -mabi=ibmlongdouble
+endif
+
 # Add IEEE binary128 files as make targets.
 routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
                   ` (4 preceding siblings ...)
  2020-02-14 16:10 ` [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-03-03 20:18   ` Paul E Murphy
  2020-02-14 16:10 ` [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
  6 siblings, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>

Soon, powerpc64le will need to provide extra compiler flags to the long
double files in order to continue to build using the IBM 128-bit
extended floating point type as long double.
---
 sysdeps/ieee754/ldbl-128ibm/Makefile | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile
index bdba6cc6b5..c38d4f6ac2 100644
--- a/sysdeps/ieee754/ldbl-128ibm/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm/Makefile
@@ -9,8 +9,24 @@ tests += tst-strtold-ldbl-128ibm
 $(objpfx)tst-strtold-ldbl-128ibm: $(libm)
 endif
 
+ldbl-tests = test-fmodl-ldbl-128ibm test-remainderl-ldbl-128ibm \
+	     test-remquol-ldbl-128ibm test-canonical-ldbl-128ibm \
+	     test-totalorderl-ldbl-128ibm
+
 ifeq ($(subdir),math)
-tests += test-fmodl-ldbl-128ibm test-remainderl-ldbl-128ibm \
-	 test-remquol-ldbl-128ibm test-canonical-ldbl-128ibm \
-	 test-totalorderl-ldbl-128ibm
+tests += $(ldbl-tests)
 endif
+
+# Long double files may need extra CFLAGS.
+ldbl-128ibm-routines = s_nexttoward s_nexttowardf \
+		       $(type-ldouble-routines) \
+		       $(subst F,$(type-ldouble-suffix),$(libm-compat-calls)) \
+		       $(subst F,$(type-ldouble-suffix),$(libm-calls)) \
+		       $(subst F,$(type-ldouble-suffix),$(calls)) \
+		       $(foreach f,$(libm-narrow-fns), \
+				 $(subst F,$(f), \
+					 $(libm-narrow-types-ldouble-yes)))
+$(foreach suf,$(all-object-suffixes), \
+	  $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
+		    $(objpfx)$(r)$(suf))): \
+  CFLAGS += $(type-ldouble-CFLAGS)
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
                   ` (5 preceding siblings ...)
  2020-02-14 16:10 ` [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags Paul E. Murphy
@ 2020-02-14 16:10 ` Paul E. Murphy
  2020-02-27 20:58   ` Tulio Magno Quites Machado Filho
  2020-02-28 17:21   ` Paul E Murphy
  6 siblings, 2 replies; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-14 16:10 UTC (permalink / raw)
  To: libc-alpha

Tweak the PLT bypass magic when building glibc with long double
redirects.  This is made more difficult by the fact we only get
one chance to redirect functions.  This happens via the public
headers.

There are roughly three classes of redirect we need to attend to
today:

 1. Simple redirects, redirected via cdef macro overrides and
    and new libc_hidden_ldbl_proto macro.
 2. Internal usage of internal API, e.g __snprintf, which has
    no direct analogue.  This is bypassed directly on case-by-
    case basis.
 3. Double redirects, e.g sscanf and related.  These require
    a heavier handed approach of macro renaming to existing
    symbols.

Most simple redirects are handled via 1.  Ideally, the libc_*
macro would live in libc-symbols.h, but in practice the macros
needed for it to do anything useful live in cdefs.h, so they
are defined in the local override.

Notably, the internal name of asprintf is renamed to work with
internal prefixed usage.

This resolves the local plt usage introduced when building glibc
with ldbl == ieee128 on ppc64le.
---
 include/err.h                                 | 12 ++---
 include/stdio.h                               | 51 +++++++++++++------
 include/sys/cdefs.h                           | 23 +++++++++
 include/sys/syslog.h                          |  2 +-
 include/wchar.h                               |  2 +-
 .../ldbl-128ibm-compat/ieee128-asprintf.c     |  5 +-
 .../ldbl-128ibm-compat/ieee128-dprintf.c      |  1 +
 .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |  7 +++
 .../ldbl-128ibm-compat/ieee128-fprintf.c      |  1 +
 .../ieee128-isoc99_sscanf.c                   |  1 +
 .../ieee128-isoc99_vfscanf.c                  |  2 +
 .../ieee128-isoc99_vsscanf.c                  |  1 +
 .../ldbl-128ibm-compat/ieee128-sprintf.c      |  1 +
 .../ldbl-128ibm-compat/ieee128-syslog.c       |  1 +
 .../ldbl-128ibm-compat/ieee128-vfprintf.c     |  1 +
 .../ldbl-128ibm/include/bits/iscanonical.h    |  2 +-
 16 files changed, 87 insertions(+), 26 deletions(-)

diff --git a/include/err.h b/include/err.h
index 7c05cd1dbb..b9b7516287 100644
--- a/include/err.h
+++ b/include/err.h
@@ -12,12 +12,12 @@ __vwarn_internal (const char *format, __gnuc_va_list ap,
 
 # ifndef _ISOMAC
 
-libc_hidden_proto (warn)
-libc_hidden_proto (warnx)
-libc_hidden_proto (vwarn)
-libc_hidden_proto (vwarnx)
-libc_hidden_proto (verr)
-libc_hidden_proto (verrx)
+libc_hidden_ldbl_proto (warn)
+libc_hidden_ldbl_proto (warnx)
+libc_hidden_ldbl_proto (vwarn)
+libc_hidden_ldbl_proto (vwarnx)
+libc_hidden_ldbl_proto (verr)
+libc_hidden_ldbl_proto (verrx)
 
 # endif /* !_ISOMAC */
 #endif /* err.h */
diff --git a/include/stdio.h b/include/stdio.h
index dffa7765dd..ab3d375ec7 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -9,13 +9,23 @@
 
 /* Now define the internal interfaces.  */
 
+/* Take a little more care when redirecting internal only symbols. Anything
+   internal to libc should redirect to internal function name. */
+# if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc)
+#  define stdio_hidden_ldbl_proto(p, f) \
+  extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f));
+# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128)
+# else
+#  define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
+# endif
+
 extern int __fcloseall (void) attribute_hidden;
 extern int __snprintf (char *__restrict __s, size_t __maxlen,
 		       const char *__restrict __format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
-#  if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (__snprintf)
-#  endif
+stdio_hidden_ldbl_proto (__, snprintf)
+
 extern int __vfscanf (FILE *__restrict __s,
 		      const char *__restrict __format,
 		      __gnuc_va_list __arg)
@@ -66,6 +76,7 @@ extern int __isoc99_vscanf (const char *__restrict __format,
 extern int __isoc99_vsscanf (const char *__restrict __s,
 			     const char *__restrict __format,
 			     __gnuc_va_list __arg) __THROW;
+
 libc_hidden_proto (__isoc99_sscanf)
 libc_hidden_proto (__isoc99_vsscanf)
 libc_hidden_proto (__isoc99_vfscanf)
@@ -74,12 +85,25 @@ libc_hidden_proto (__isoc99_vfscanf)
    Unfortunately, symbol redirection is not transitive, so the
    __REDIRECT in the public header does not link up with the above
    libc_hidden_proto.  Bridge the gap with a macro.  */
-#  if !__GLIBC_USE (DEPRECATED_SCANF) \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+#  if !__GLIBC_USE (DEPRECATED_SCANF)
 #   undef sscanf
 #   define sscanf __isoc99_sscanf
 #  endif
 
+#  if __LONG_DOUBLE_USES_FLOAT128 == 1  && IS_IN (libc)
+/* These are implemented as redirects to other public API.
+   Therefore, the usual redirection fails to avoid PLT.  */
+extern __typeof (__isoc99_sscanf) ___ieee128_isoc99_sscanf __THROW;
+extern __typeof (__isoc99_vsscanf) ___ieee128_isoc99_vsscanf __THROW;
+extern __typeof (__isoc99_vfscanf) ___ieee128_isoc99_vfscanf __THROW;
+libc_hidden_proto (___ieee128_isoc99_sscanf)
+libc_hidden_proto (___ieee128_isoc99_vsscanf)
+libc_hidden_proto (___ieee128_isoc99_vfscanf)
+#define __isoc99_sscanf ___ieee128_isoc99_sscanf
+#define __isoc99_vsscanf ___ieee128_isoc99_vsscanf
+#define __isoc99_vfscanf ___ieee128_isoc99_vfscanf
+#  endif
+
 /* Prototypes for compatibility functions.  */
 extern FILE *__new_tmpfile (void);
 extern FILE *__old_tmpfile (void);
@@ -153,9 +177,8 @@ libc_hidden_proto (__libc_readline_unlocked);
 extern const char *const _sys_errlist_internal[] attribute_hidden;
 extern int _sys_nerr_internal attribute_hidden;
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (__asprintf)
-#endif
+libc_hidden_ldbl_proto (__asprintf)
+
 #  if IS_IN (libc)
 extern FILE *_IO_new_fopen (const char*, const char*);
 #   define fopen(fname, mode) _IO_new_fopen (fname, mode)
@@ -178,13 +201,11 @@ extern int _IO_new_fgetpos (FILE *, __fpos_t *);
 
 extern __typeof (dprintf) __dprintf
      __attribute__ ((__format__ (__printf__, 2, 3)));
-libc_hidden_proto (__dprintf)
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
-libc_hidden_proto (dprintf)
-libc_hidden_proto (fprintf)
-libc_hidden_proto (vfprintf)
-libc_hidden_proto (sprintf)
-#endif
+stdio_hidden_ldbl_proto (__, dprintf)
+libc_hidden_ldbl_proto (dprintf)
+libc_hidden_ldbl_proto (fprintf)
+libc_hidden_ldbl_proto (vfprintf)
+libc_hidden_ldbl_proto (sprintf)
 libc_hidden_proto (fwrite)
 libc_hidden_proto (perror)
 libc_hidden_proto (remove)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 524fe57a25..ae5802e744 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -15,4 +15,27 @@ rtld_hidden_proto (__chk_fail)
 
 #endif
 
+/* If we are using redirects internally to support long double,
+   we need to tweak some macros to ensure the PLT bypass tricks
+   continue to work in libc. */
+#if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) && defined SHARED
+
+# undef __LDBL_REDIR_DECL
+# define __LDBL_REDIR_DECL(name)
+
+# undef __LDBL_REDIR2_DECL
+# define __LDBL_REDIR2_DECL(name)
+
+# undef __LDBL_REDIR1_DECL
+# define __LDBL_REDIR1_DECL(name, to)
+
+# define libc_hidden_ldbl_proto(func) \
+   extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func)); \
+   extern __typeof(func) ___ieee128_ ## func; \
+   libc_hidden_proto (___ieee128_ ## func);
+
+#else
+# define libc_hidden_ldbl_proto(func) libc_hidden_proto (func)
+#endif
+
 #endif
diff --git a/include/sys/syslog.h b/include/sys/syslog.h
index 89d3479ebc..44422eab13 100644
--- a/include/sys/syslog.h
+++ b/include/sys/syslog.h
@@ -3,7 +3,7 @@
 #include <misc/sys/syslog.h>
 #ifndef _ISOMAC
 
-libc_hidden_proto (syslog)
+libc_hidden_ldbl_proto (syslog)
 
 /* __vsyslog_internal uses the same mode_flags bits as
    __v*printf_internal; see libio/libioP.h.  */
diff --git a/include/wchar.h b/include/wchar.h
index c792b38943..617906eb14 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -64,7 +64,7 @@ libc_hidden_proto (__wcstoul_internal)
 libc_hidden_proto (__wcstoull_internal)
 libc_hidden_proto (wcstof)
 libc_hidden_proto (wcstod)
-libc_hidden_proto (wcstold)
+libc_hidden_ldbl_proto (wcstold)
 libc_hidden_proto (wcstol)
 libc_hidden_proto (wcstoll)
 libc_hidden_proto (wcstoul)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
index 68cafbb2fa..2a6ed2f813 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-asprintf.c
@@ -20,7 +20,7 @@
 #include <libio/libioP.h>
 
 extern int
-___ieee128_asprintf (char **string_ptr, const char *format, ...)
+___ieee128___asprintf (char **string_ptr, const char *format, ...)
 {
   va_list ap;
   int done;
@@ -32,4 +32,5 @@ ___ieee128_asprintf (char **string_ptr, const char *format, ...)
 
   return done;
 }
-strong_alias (___ieee128_asprintf, __asprintfieee128)
+hidden_def (___ieee128___asprintf)
+strong_alias (___ieee128___asprintf, __asprintfieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
index 9dc65309bd..87440c9850 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-dprintf.c
@@ -32,3 +32,4 @@ ___ieee128_dprintf (int d, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_dprintf, __dprintfieee128)
+hidden_def (___ieee128_dprintf);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
index eae071b9c4..f81d3edcbf 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-err.c
@@ -91,3 +91,10 @@ IEEE128_DECL (errx) (int status, const char *format, ...)
   VA (verrx (status, format, ap))
 }
 IEEE128_ALIAS (errx)
+
+hidden_def (___ieee128_warn)
+hidden_def (___ieee128_warnx)
+hidden_def (___ieee128_vwarn)
+hidden_def (___ieee128_vwarnx)
+hidden_def (___ieee128_verr)
+hidden_def (___ieee128_verrx)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index e1c989643e..b05e6f1bc6 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -32,3 +32,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_fprintf, __fprintfieee128)
+hidden_def (___ieee128_fprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
index bfc7270a78..cd1c9fa333 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_sscanf.c
@@ -37,3 +37,4 @@ ___ieee128_isoc99_sscanf (const char *string, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_isoc99_sscanf, __isoc99_sscanfieee128)
+hidden_def (___ieee128_isoc99_sscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
index b561fa3044..2a11f49ea6 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vfscanf.c
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <libio/libioP.h>
+#include <stdio.h>
 
 extern int
 ___ieee128_isoc99_vfscanf (FILE *fp, const char *format, va_list ap)
@@ -25,3 +26,4 @@ ___ieee128_isoc99_vfscanf (FILE *fp, const char *format, va_list ap)
   return __vfscanf_internal (fp, format, ap, mode_flags);
 }
 strong_alias (___ieee128_isoc99_vfscanf, __isoc99_vfscanfieee128)
+hidden_def (___ieee128_isoc99_vfscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
index bef6ebcce0..d976cdbe1f 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-isoc99_vsscanf.c
@@ -28,3 +28,4 @@ ___ieee128_isoc99_vsscanf (const char *string, const char *format, va_list ap)
   return __vfscanf_internal (fp, format, ap, mode_flags);
 }
 strong_alias (___ieee128_isoc99_vsscanf, __isoc99_vsscanfieee128)
+hidden_def (___ieee128_isoc99_vsscanf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 52088cd576..690dc3abf1 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -33,3 +33,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_sprintf, __sprintfieee128)
+hidden_def (___ieee128_sprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
index 914f24aebd..4af546326c 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c
@@ -30,6 +30,7 @@ ___ieee128_syslog (int pri, const char *fmt, ...)
   va_end (ap);
 }
 strong_alias (___ieee128_syslog, __syslogieee128)
+hidden_def (___ieee128_syslog)
 
 void
 ___ieee128_vsyslog (int pri, const char *fmt, va_list ap)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
index 234cd9de8d..b407eae969 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-vfprintf.c
@@ -24,3 +24,4 @@ ___ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
   return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
 }
 strong_alias (___ieee128_vfprintf, __vfprintfieee128)
+hidden_def (___ieee128_vfprintf)
diff --git a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
index bee080bd29..8cbd6f74bf 100644
--- a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
+++ b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
@@ -1,5 +1,5 @@
 #include_next <bits/iscanonical.h>
 
-#ifndef _ISOMAC
+#if !defined _ISOMAC && (__LONG_DOUBLE_USES_FLOAT128 == 0)
 libm_hidden_proto (__iscanonicall)
 #endif
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-14 16:10 ` [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions Paul E. Murphy
@ 2020-02-14 17:31   ` Joseph Myers
  2020-02-14 18:22     ` Paul E Murphy
  2020-02-17 22:06     ` [PATCHv2 " Paul E. Murphy
  0 siblings, 2 replies; 28+ messages in thread
From: Joseph Myers @ 2020-02-14 17:31 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Fri, 14 Feb 2020, Paul E. Murphy wrote:

> diff --git a/math/test-float128.h b/math/test-float128.h
> index 8f9eec14aa..07945a090b 100644
> --- a/math/test-float128.h
> +++ b/math/test-float128.h
> @@ -28,7 +28,7 @@
>  #define CFLOAT __CFLOAT128
>  #define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag)))
>  #define PREFIX FLT128
> -#if FLT128_MANT_DIG == LDBL_MANT_DIG
> +#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT128_MANT_DIG == LDBL_MANT_DIG
>  # define TYPE_STR "ldouble"
>  # define ULP_IDX ULP_LDBL
>  # define ULP_I_IDX ULP_I_LDBL

This condition doesn't make sense to me, but it may be because 
__LONG_DOUBLE_USES_FLOAT128 is a badly named macro.  Could you please post 
a patch that adds a comment to the top-level bits/long-double.h that 
documents the detailed semantics of the __LONG_DOUBLE_USES_FLOAT128, and 
then we can consider whether that macro needs to be given a better name?

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-14 17:31   ` Joseph Myers
@ 2020-02-14 18:22     ` Paul E Murphy
  2020-02-14 21:13       ` Joseph Myers
  2020-02-17 22:06     ` [PATCHv2 " Paul E. Murphy
  1 sibling, 1 reply; 28+ messages in thread
From: Paul E Murphy @ 2020-02-14 18:22 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 2/14/20 11:31 AM, Joseph Myers wrote:
> On Fri, 14 Feb 2020, Paul E. Murphy wrote:
> 
>> diff --git a/math/test-float128.h b/math/test-float128.h
>> index 8f9eec14aa..07945a090b 100644
>> --- a/math/test-float128.h
>> +++ b/math/test-float128.h
>> @@ -28,7 +28,7 @@
>>   #define CFLOAT __CFLOAT128
>>   #define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag)))
>>   #define PREFIX FLT128
>> -#if FLT128_MANT_DIG == LDBL_MANT_DIG
>> +#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT128_MANT_DIG == LDBL_MANT_DIG
>>   # define TYPE_STR "ldouble"
>>   # define ULP_IDX ULP_LDBL
>>   # define ULP_I_IDX ULP_I_LDBL
> 
> This condition doesn't make sense to me, but it may be because
> __LONG_DOUBLE_USES_FLOAT128 is a badly named macro.  Could you please post
> a patch that adds a comment to the top-level bits/long-double.h that
> documents the detailed semantics of the __LONG_DOUBLE_USES_FLOAT128, and
> then we can consider whether that macro needs to be given a better name?
> 
The macro might better read as something like 
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI.  Would such be a more fitting name?

Anyhow, toward this patch, I think it is using the wrong macro. 
__HAVE_DISTINCT_FLOAT128  == 0 seems to be the appropriate test.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-14 18:22     ` Paul E Murphy
@ 2020-02-14 21:13       ` Joseph Myers
  0 siblings, 0 replies; 28+ messages in thread
From: Joseph Myers @ 2020-02-14 21:13 UTC (permalink / raw)
  To: Paul E Murphy; +Cc: libc-alpha

On Fri, 14 Feb 2020, Paul E Murphy wrote:

> The macro might better read as something like
> __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI.  Would such be a more fitting name?

Yes, that seems like a better name, as far as I understand how the macro 
is used.  In any case, it needs a comment to specify its semantics.  The 
comment needs to be clear which parts of the semantics relate to "the ABI 
for this glibc as a whole" versus "the ABI for this particular compilation 
using this glibc and the particular choice of long double made with the 
current compilation options".

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCHv2 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-14 17:31   ` Joseph Myers
  2020-02-14 18:22     ` Paul E Murphy
@ 2020-02-17 22:06     ` Paul E. Murphy
  2020-02-17 22:24       ` Joseph Myers
  2020-02-18 22:00       ` [PATCHv3] " Paul E. Murphy
  1 sibling, 2 replies; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-17 22:06 UTC (permalink / raw)
  To: libc-alpha

From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>

My brain misfired last friday.  Such things are not always unheard of on
such weekdays.  The reason for the awkward macro usage is to work around
old compiler quirks.  ppc64le will need to bump the minimum compiler
version to 7.3 from 6.2 to support building with the new ldouble format.

The reason for the awkward __LONG_DOUBLE_USES_FLOAT128 test is that GCC 7
compilers can (and do via later patchsets) get invoked with
"-mabi=ieeelongdouble" and without "-mfloat128".  GCC 7 treats this
as not having _Float128 and thereby __HAVE_DISTINCT_FLOAT128 == 0.

I have added a comment noting the above. Likewise, the copyright year is
updated in test-ibm.h.  Likewise, fix up the co-authorship comments.

---8<---

This patch creates test-ibm128* tests from the long double function tests.
In order to explicitly test IBM long double functions -mabi=ibmlongdouble is
added to CFLAGS.

Likewise, update the test headers to correct choose ULPs when redirects
are enabled.

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

---
 math/Makefile                                 |  7 ++-
 math/test-float128.h                          |  6 ++-
 math/test-float64x.h                          |  6 ++-
 math/test-ibm128.h                            | 19 +++++++
 math/test-ldouble.h                           |  6 +++
 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 ++
 sysdeps/powerpc/powerpc64/le/Makefile         | 50 ++++++++++++++++---
 7 files changed, 88 insertions(+), 9 deletions(-)
 create mode 100644 math/test-ibm128.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig

diff --git a/math/Makefile b/math/Makefile
index 1d203e7ad5..84a8b94c74 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -145,10 +145,15 @@ type-float128-yes := float128
 # _Float64x may be supported, only as an alias type.
 type-float64x-yes := float64x
 
+# IBM long double support in additional to IEEE 128 long double support
+type-ibm128-suffix := l
+type-ibm128-yes := ibm128
+
 types = $(types-basic) $(type-float128-$(float128-fcts))
 test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
 	     float32 float64 $(type-float128-$(float128-alias-fcts)) \
-	     float32x $(type-float64x-$(float64x-alias-fcts))
+	     float32x $(type-float64x-$(float64x-alias-fcts)) \
+	     $(type-ibm128-$(ibm128-fcts))
 
 # Pairs of types for which narrowing functions should be tested (this
 # variable has more entries than libm-narrow-types because it includes
diff --git a/math/test-float128.h b/math/test-float128.h
index 8f9eec14aa..4cf18fe8d1 100644
--- a/math/test-float128.h
+++ b/math/test-float128.h
@@ -28,7 +28,11 @@
 #define CFLOAT __CFLOAT128
 #define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag)))
 #define PREFIX FLT128
-#if FLT128_MANT_DIG == LDBL_MANT_DIG
+/* __LONG_DOUBLE_USES_FLOAT128 is used instead of __HAVE_DISTINCT_FLOAT128
+   because GCC 7 compilers can support IEEE 128 long double without
+   outwardly supporting _Float128.  When minimum GCC is raised to 8, this
+   check can be replaced.  */
+#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT128_MANT_DIG == LDBL_MANT_DIG
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
 # define ULP_I_IDX ULP_I_LDBL
diff --git a/math/test-float64x.h b/math/test-float64x.h
index 9543238209..1e9916c2d8 100644
--- a/math/test-float64x.h
+++ b/math/test-float64x.h
@@ -28,7 +28,11 @@
 #define CFLOAT __CFLOAT64X
 #define BUILD_COMPLEX(real, imag) (CMPLXF64X ((real), (imag)))
 #define PREFIX FLT64X
-#if FLT64X_MANT_DIG == LDBL_MANT_DIG
+/* __LONG_DOUBLE_USES_FLOAT128 is used instead of __HAVE_DISTINCT_FLOAT128
+   because GCC 7 compilers can support IEEE 128 long double without
+   outwardly supporting _Float128.  When minimum GCC is raised to 8, this
+   check can be replaced.  */
+#if __LONG_DOUBLE_USES_FLOAT128 == 0 && FLT64X_MANT_DIG == LDBL_MANT_DIG
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
 # define ULP_I_IDX ULP_I_LDBL
diff --git a/math/test-ibm128.h b/math/test-ibm128.h
new file mode 100644
index 0000000000..fce6ef1376
--- /dev/null
+++ b/math/test-ibm128.h
@@ -0,0 +1,19 @@
+/* Common definitions for libm tests for ibm long double.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "test-ldouble.h"
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 17c526bd71..1dc1c86c07 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -27,6 +27,12 @@
 # define TYPE_STR "double"
 # define ULP_IDX ULP_DBL
 # define ULP_I_IDX ULP_I_DBL
+#elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# define TYPE_STR "float128"
+# define ULP_IDX ULP_FLT128
+# define ULP_I_IDX ULP_I_FLT128
+/* _Float128 unconditionally redirects to lgamma.  Ensure the ULPs do too.  */
+# define gamma lgamma
 #else
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
new file mode 100644
index 0000000000..997f632319
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
@@ -0,0 +1,3 @@
+# Include this earlier so it can be used earlier in Makefiles,
+# and sysdep/ makefiles.
+ibm128-fcts = yes
diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 0ce3868c3c..1594f6b179 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
@@ -28,13 +35,34 @@ CFLAGS-test-math-iscanonical.cc += -mfloat128
 CFLAGS-test-math-iseqsig.cc += -mfloat128
 CFLAGS-test-math-issignaling.cc += -mfloat128
 CFLAGS-test-math-iszero.cc += -mfloat128
-$(foreach test, \
-	  test-float128% test-ifloat128% test-float64x% test-ifloat64x% \
-	  $(foreach pair,$(f128-pairs),test-$(pair)%) \
-	  test-math-iscanonical test-math-iseqsig test-math-issignaling \
-	  test-math-iszero, \
-	  $(objpfx)$(test)): \
+$(foreach test,\
+	  basic-test \
+	  bug-nextafter \
+	  bug-nexttoward \
+	  test-fenv-clear \
+	  test-iszero-excess-precision \
+	  test-math-iscanonical \
+	  test-math-iseqsig \
+	  test-math-issignaling \
+	  test-math-iszero \
+	  test-misc \
+	  test-nan-overflow \
+	  test-nan-payload \
+	  test-snan \
+	  test-tgmath \
+	  test-tgmath2 \
+	  tst-CMPLX2 \
+	  test-%-ldbl-128ibm \
+	  test-ldouble% test-ildouble% \
+	  test-float128% test-ifloat128% \
+	  test-float64x% test-ifloat64x% \
+	  ,$(objpfx)$(test)): \
   gnulib-tests += $(f128-loader-link)
+
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
 endif
 
 # Append flags to string <-> _Float128 routines.
@@ -82,3 +110,13 @@ CFLAGS-printf_fp.c = -mfloat128
 CFLAGS-printf_fphex.c = -mfloat128
 CFLAGS-printf_size.c = -mfloat128
 endif
+
+$(foreach suf,$(all-object-suffixes),nldbl-%$(suf)): \
+  CFLAGS += $(type-ldouble-CFLAGS)
+
+sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)libm-test-%ibm128$(suf) \
+         $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
+  sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble \
+    -Wno-psabi, $(sysdep-CFLAGS))
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCHv2 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-17 22:06     ` [PATCHv2 " Paul E. Murphy
@ 2020-02-17 22:24       ` Joseph Myers
  2020-02-18 22:00       ` [PATCHv3] " Paul E. Murphy
  1 sibling, 0 replies; 28+ messages in thread
From: Joseph Myers @ 2020-02-17 22:24 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Mon, 17 Feb 2020, Paul E. Murphy wrote:

> The reason for the awkward __LONG_DOUBLE_USES_FLOAT128 test is that GCC 7
> compilers can (and do via later patchsets) get invoked with
> "-mabi=ieeelongdouble" and without "-mfloat128".  GCC 7 treats this
> as not having _Float128 and thereby __HAVE_DISTINCT_FLOAT128 == 0.

Why are you building without -mfloat128?

Normally, code built with GCC 7 can expect that, if long double has the 
binary128 format, _Float128 is also available.  Having powerpc64le (only) 
break that invariant seems a bad idea.  I think you should make sure that 
__HAVE_FLOAT128 and __HAVE_DISTINCT_FLOAT128 both are defined to 1 (that 
you compile with options causing them to be defined to 1) when building 
any parts of glibc that use binary128, rather than working around them 
being defined to 0.

> -#if FLT128_MANT_DIG == LDBL_MANT_DIG
> +/* __LONG_DOUBLE_USES_FLOAT128 is used instead of __HAVE_DISTINCT_FLOAT128
> +   because GCC 7 compilers can support IEEE 128 long double without
> +   outwardly supporting _Float128.  When minimum GCC is raised to 8, this
> +   check can be replaced.  */

Any place where something can be simplified when the minimum GCC version 
is increased should have a conditional using __GNUC_PREREQ, not just a 
free-form comment; that's the only way we can effectively find all such 
places when increasing the minimum GCC version.

> +/* _Float128 unconditionally redirects to lgamma.  Ensure the ULPs do too.  */
> +# define gamma lgamma

Rather than a hack like this, I think you should do one of the following:

* Just all the float128 ulps for gamma to the relevant libm-test-ulps 
file.

* Properly implement ulps sharing in the libm-test machinery for all cases 
where tests of more than one function use the same table of tests, and 
update all libm-test-ulps files accordingly.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCHv3] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-17 22:06     ` [PATCHv2 " Paul E. Murphy
  2020-02-17 22:24       ` Joseph Myers
@ 2020-02-18 22:00       ` Paul E. Murphy
  2020-02-28 15:33         ` [PATCHv3][Ping] " Paul E Murphy
  1 sibling, 1 reply; 28+ messages in thread
From: Paul E. Murphy @ 2020-02-18 22:00 UTC (permalink / raw)
  To: libc-alpha

From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>

Simplify this further.  As correctly pointed out by Joseph, compiler
_Float128 compiler flags should always be present where needed.  Thus,
I can greatly simplify this patch.  It had collected too much cruft from
my constant rebasing.

Likewise, defer the ppc64le makefile changes.  They really shouldn't be
here, and contained harmful rebasing noise.  They have been squashed
into later, more appropriate patches.

Similarly, the hack for gamma is removed.  `make regen-ulps` behaves
as expected and fills the missing entries correctly.  The ULP changes
will be included with the enablement patch.

Tested on x86-64 and ppc64le.

---8<---

This patch creates test-ibm128* tests from the long double function tests.
In order to explicitly test IBM long double functions -mabi=ibmlongdouble is
added to CFLAGS.

Likewise, update the test headers to correct choose ULPs when redirects
are enabled.

Co-Authored-By: Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
Co-Authored-By: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
---
 math/Makefile                                 |  7 ++++++-
 math/test-ibm128.h                            | 19 +++++++++++++++++++
 math/test-ldouble.h                           |  7 +++++++
 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 +++
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 math/test-ibm128.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig

diff --git a/math/Makefile b/math/Makefile
index 1d203e7ad5..84a8b94c74 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -145,10 +145,15 @@ type-float128-yes := float128
 # _Float64x may be supported, only as an alias type.
 type-float64x-yes := float64x
 
+# IBM long double support in additional to IEEE 128 long double support
+type-ibm128-suffix := l
+type-ibm128-yes := ibm128
+
 types = $(types-basic) $(type-float128-$(float128-fcts))
 test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
 	     float32 float64 $(type-float128-$(float128-alias-fcts)) \
-	     float32x $(type-float64x-$(float64x-alias-fcts))
+	     float32x $(type-float64x-$(float64x-alias-fcts)) \
+	     $(type-ibm128-$(ibm128-fcts))
 
 # Pairs of types for which narrowing functions should be tested (this
 # variable has more entries than libm-narrow-types because it includes
diff --git a/math/test-ibm128.h b/math/test-ibm128.h
new file mode 100644
index 0000000000..fce6ef1376
--- /dev/null
+++ b/math/test-ibm128.h
@@ -0,0 +1,19 @@
+/* Common definitions for libm tests for ibm long double.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "test-ldouble.h"
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 17c526bd71..5b72915008 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -27,6 +27,13 @@
 # define TYPE_STR "double"
 # define ULP_IDX ULP_DBL
 # define ULP_I_IDX ULP_I_DBL
+/* On architectures which redirect long double to _Float128 ABI, we must
+   choose the float128 ulps.  Similarly, on such architectures, the ABI
+   used may be dependent on how the compiler was invoked.  */
+#elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# define TYPE_STR "float128"
+# define ULP_IDX ULP_FLT128
+# define ULP_I_IDX ULP_I_FLT128
 #else
 # define TYPE_STR "ldouble"
 # define ULP_IDX ULP_LDBL
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
new file mode 100644
index 0000000000..997f632319
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
@@ -0,0 +1,3 @@
+# Include this earlier so it can be used earlier in Makefiles,
+# and sysdep/ makefiles.
+ibm128-fcts = yes
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs
  2020-02-14 16:10 ` [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs Paul E. Murphy
@ 2020-02-21 14:34   ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-02-21 14:34 UTC (permalink / raw)
  To: libc-alpha

While it was tested against build-many-glibcs.py, this doesn't
actually build yet.  I tested this locally for whatever that is
worth.

Pushed typo fix in comments: "it's" -> "its".

On 2/14/20 10:10 AM, Paul E. Murphy wrote:
> We want to ensure that if a second file is built to support
> ieee128 long double, we built it's companion implementation
> with ibm128 long double.  The shared object versions of these
> files build correctly because the aliasing is sufficiently
> complex to prevent the redirects from applying when defining
> them.
> 
> However, this does not prevent the static object variants
> from becoming quietly broken due to redirects.  This is
> intentionally avoided by marking such objects to be built
> with -mabi=ibmlongdouble.
> 
> Shuffle the misplaced routines to build against the subdir
> which defines the needed symbols.
> ---
>   sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 32 ++++++++++-----------
>   1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> index 2dceb658e7..e40ae08469 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file
  2020-02-14 16:10 ` [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file Paul E. Murphy
@ 2020-02-21 14:35   ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-02-21 14:35 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

Pushed.  Again, tested locally as this is not currently use
by any target.  But testd with build-many-glibcs.py with the
other patches committed.

On 2/14/20 10:10 AM, Paul E. Murphy wrote:
> A number of utility files and helper objects should also be
> explicitly configured to build with the ibm128 ABI to prevent
> gremlins when enabling IEEE long double.
> ---
>   sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> index 7efbd00089..2dceb658e7 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> @@ -338,6 +338,17 @@ ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
>   		     $(objpfx)iovswscanf^ \
>   		     $(objpfx)iovfscanf^ \
>   		     $(objpfx)iovfwscanf^ \
> +		     $(objpfx)mpn2ldbl^ \
> +		     $(objpfx)ldbl2mpn^ \
> +		     $(objpfx)strtold_nan^ \
> +		     $(objpfx)strtold_l^ \
> +		     $(objpfx)strtold^ \
> +		     $(objpfx)strfroml^ \
> +		     $(objpfx)wcstold_nan^ \
> +		     $(objpfx)wcstold_l^ \
> +		     $(objpfx)wcstold^ \
> +		     $(objpfx)printf_fphex^ \
> +		     $(objpfx)printf_fp^ \
>   		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
>   		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
>   obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions
  2020-02-14 16:10 ` [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions Paul E. Murphy
@ 2020-02-27 20:16   ` Tulio Magno Quites Machado Filho
  2020-02-28 14:56     ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-02-27 20:16 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>
>
> The functions in the nexttoward family are special, in the sense that
> they always have a long double argument, regardless of their suffix
> (i.e.: nexttowardf and nexttoward have a long double argument, besides
> the float and double arguments).
>
> On top of that, they are also special because nexttoward functions are
> not part of the _FloatN API, hence __nexttowardf128 do not exist.
>
> This patch adds 4 new function implementations for the new long double
> format:
>
>   __nexttoward_to_ieee128
>   __nexttowardf_to_ieee128
>   __nexttowardieee128 (as an alias to __nextafterieee128)
>
> Likewise, rename "long double" "_Float128" in shared ldbl-128
> files to ensure correct type is used irrespective of ABI
> switches.

LGTM.

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

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests
  2020-02-14 16:10 ` [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests Paul E. Murphy
@ 2020-02-27 20:39   ` Tulio Magno Quites Machado Filho
  2020-02-27 22:45     ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-02-27 20:39 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> For lack of a more comprehensive solution, tack on the ibm128 ABI
> compiler options for the totalorder{,mag}l compat tests which exist
> prior to enabling this feature.
> ---
>  sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> index e40ae08469..af8027cf0e 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
> @@ -270,6 +270,7 @@ tests-internal += tst-ibm128-error tst-ieee128-error
>  tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
>  
>  $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
> +$(objpfx)tst-ldbl-efgcvt: gnulib-tests += $(f128-loader-link)

LGTM, but I think this test should mentioned in the commit message too.

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

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-02-14 16:10 ` [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
@ 2020-02-27 20:58   ` Tulio Magno Quites Machado Filho
  2020-02-28 17:21   ` Paul E Murphy
  1 sibling, 0 replies; 28+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-02-27 20:58 UTC (permalink / raw)
  To: Paul E. Murphy, libc-alpha

"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> Tweak the PLT bypass magic when building glibc with long double
> redirects.  This is made more difficult by the fact we only get
> one chance to redirect functions.  This happens via the public
> headers.
>
> There are roughly three classes of redirect we need to attend to
> today:
>
>  1. Simple redirects, redirected via cdef macro overrides and
>     and new libc_hidden_ldbl_proto macro.
>  2. Internal usage of internal API, e.g __snprintf, which has
>     no direct analogue.  This is bypassed directly on case-by-
>     case basis.
>  3. Double redirects, e.g sscanf and related.  These require
>     a heavier handed approach of macro renaming to existing
>     symbols.
>
> Most simple redirects are handled via 1.  Ideally, the libc_*
> macro would live in libc-symbols.h, but in practice the macros
> needed for it to do anything useful live in cdefs.h, so they
> are defined in the local override.
>
> Notably, the internal name of asprintf is renamed to work with
> internal prefixed usage.
>
> This resolves the local plt usage introduced when building glibc
> with ldbl == ieee128 on ppc64le.

LGTM.

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

-- 
Tulio Magno


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests
  2020-02-27 20:39   ` Tulio Magno Quites Machado Filho
@ 2020-02-27 22:45     ` Paul E Murphy
  2020-02-28 14:57       ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Paul E Murphy @ 2020-02-27 22:45 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 2/27/20 2:39 PM, Tulio Magno Quites Machado Filho wrote:
> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> 
>> For lack of a more comprehensive solution, tack on the ibm128 ABI
>> compiler options for the totalorder{,mag}l compat tests which exist
>> prior to enabling this feature.
>> ---
>>   sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>> index e40ae08469..af8027cf0e 100644
>> --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>> @@ -270,6 +270,7 @@ tests-internal += tst-ibm128-error tst-ieee128-error
>>   tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
>>   
>>   $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
>> +$(objpfx)tst-ldbl-efgcvt: gnulib-tests += $(f128-loader-link)

I agree and missed this when refactoring patches.  It has been moved 
into a separate patch.

> LGTM, but I think this test should mentioned in the commit message too.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions
  2020-02-27 20:16   ` Tulio Magno Quites Machado Filho
@ 2020-02-28 14:56     ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-02-28 14:56 UTC (permalink / raw)
  To: libc-alpha


On 2/27/20 2:16 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>
>>
>> The functions in the nexttoward family are special, in the sense that
>> they always have a long double argument, regardless of their suffix
>> (i.e.: nexttowardf and nexttoward have a long double argument, besides
>> the float and double arguments).
>>
>> On top of that, they are also special because nexttoward functions are
>> not part of the _FloatN API, hence __nexttowardf128 do not exist.
>>
>> This patch adds 4 new function implementations for the new long double
>> format:
>>
>>    __nexttoward_to_ieee128
>>    __nexttowardf_to_ieee128
>>    __nexttowardieee128 (as an alias to __nextafterieee128)
>>
>> Likewise, rename "long double" "_Float128" in shared ldbl-128
>> files to ensure correct type is used irrespective of ABI
>> switches.
> 
> LGTM.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

Committed.  Thanks!

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests
  2020-02-27 22:45     ` Paul E Murphy
@ 2020-02-28 14:57       ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-02-28 14:57 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Paul E. Murphy, libc-alpha



On 2/27/20 4:45 PM, Paul E Murphy wrote:
> 
> 
> On 2/27/20 2:39 PM, Tulio Magno Quites Machado Filho wrote:
>> "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
>>
>>> For lack of a more comprehensive solution, tack on the ibm128 ABI
>>> compiler options for the totalorder{,mag}l compat tests which exist
>>> prior to enabling this feature.
>>> ---
>>>   sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 10 ++++++++++
>>>   1 file changed, 10 insertions(+)
>>>
>>> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile 
>>> b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>>> index e40ae08469..af8027cf0e 100644
>>> --- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>>> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
>>> @@ -270,6 +270,7 @@ tests-internal += tst-ibm128-error tst-ieee128-error
>>>   tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
>>>   $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
>>> +$(objpfx)tst-ldbl-efgcvt: gnulib-tests += $(f128-loader-link)
> 
> I agree and missed this when refactoring patches.  It has been moved 
> into a separate patch.
> 
>> LGTM, but I think this test should mentioned in the commit message too.
>>
>> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
>>

Committed and trivial one-liner moved to a second commit and committed.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv3][Ping] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-18 22:00       ` [PATCHv3] " Paul E. Murphy
@ 2020-02-28 15:33         ` Paul E Murphy
  2020-03-03 20:17           ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Paul E Murphy @ 2020-02-28 15:33 UTC (permalink / raw)
  To: libc-alpha

Ping.

On 2/18/20 4:00 PM, Paul E. Murphy wrote:
> From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
> 
> Simplify this further.  As correctly pointed out by Joseph, compiler
> _Float128 compiler flags should always be present where needed.  Thus,
> I can greatly simplify this patch.  It had collected too much cruft from
> my constant rebasing.
> 
> Likewise, defer the ppc64le makefile changes.  They really shouldn't be
> here, and contained harmful rebasing noise.  They have been squashed
> into later, more appropriate patches.
> 
> Similarly, the hack for gamma is removed.  `make regen-ulps` behaves
> as expected and fills the missing entries correctly.  The ULP changes
> will be included with the enablement patch.
> 
> Tested on x86-64 and ppc64le.
> 
> ---8<---
> 
> This patch creates test-ibm128* tests from the long double function tests.
> In order to explicitly test IBM long double functions -mabi=ibmlongdouble is
> added to CFLAGS.
> 
> Likewise, update the test headers to correct choose ULPs when redirects
> are enabled.
> 
> Co-Authored-By: Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
> Co-Authored-By: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
> ---
>   math/Makefile                                 |  7 ++++++-
>   math/test-ibm128.h                            | 19 +++++++++++++++++++
>   math/test-ldouble.h                           |  7 +++++++
>   sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 +++
>   4 files changed, 35 insertions(+), 1 deletion(-)
>   create mode 100644 math/test-ibm128.h
>   create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
> 
> diff --git a/math/Makefile b/math/Makefile
> index 1d203e7ad5..84a8b94c74 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -145,10 +145,15 @@ type-float128-yes := float128
>   # _Float64x may be supported, only as an alias type.
>   type-float64x-yes := float64x
> 
> +# IBM long double support in additional to IEEE 128 long double support
> +type-ibm128-suffix := l
> +type-ibm128-yes := ibm128
> +
>   types = $(types-basic) $(type-float128-$(float128-fcts))
>   test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
>   	     float32 float64 $(type-float128-$(float128-alias-fcts)) \
> -	     float32x $(type-float64x-$(float64x-alias-fcts))
> +	     float32x $(type-float64x-$(float64x-alias-fcts)) \
> +	     $(type-ibm128-$(ibm128-fcts))
> 
>   # Pairs of types for which narrowing functions should be tested (this
>   # variable has more entries than libm-narrow-types because it includes
> diff --git a/math/test-ibm128.h b/math/test-ibm128.h
> new file mode 100644
> index 0000000000..fce6ef1376
> --- /dev/null
> +++ b/math/test-ibm128.h
> @@ -0,0 +1,19 @@
> +/* Common definitions for libm tests for ibm long double.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include "test-ldouble.h"
> diff --git a/math/test-ldouble.h b/math/test-ldouble.h
> index 17c526bd71..5b72915008 100644
> --- a/math/test-ldouble.h
> +++ b/math/test-ldouble.h
> @@ -27,6 +27,13 @@
>   # define TYPE_STR "double"
>   # define ULP_IDX ULP_DBL
>   # define ULP_I_IDX ULP_I_DBL
> +/* On architectures which redirect long double to _Float128 ABI, we must
> +   choose the float128 ulps.  Similarly, on such architectures, the ABI
> +   used may be dependent on how the compiler was invoked.  */
> +#elif __LONG_DOUBLE_USES_FLOAT128 == 1
> +# define TYPE_STR "float128"
> +# define ULP_IDX ULP_FLT128
> +# define ULP_I_IDX ULP_I_FLT128
>   #else
>   # define TYPE_STR "ldouble"
>   # define ULP_IDX ULP_LDBL
> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
> new file mode 100644
> index 0000000000..997f632319
> --- /dev/null
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
> @@ -0,0 +1,3 @@
> +# Include this earlier so it can be used earlier in Makefiles,
> +# and sysdep/ makefiles.
> +ibm128-fcts = yes
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
  2020-02-14 16:10 ` [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
  2020-02-27 20:58   ` Tulio Magno Quites Machado Filho
@ 2020-02-28 17:21   ` Paul E Murphy
  1 sibling, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-02-28 17:21 UTC (permalink / raw)
  To: libc-alpha



On 2/14/20 10:10 AM, Paul E. Murphy wrote:
> Tweak the PLT bypass magic when building glibc with long double
> redirects.  This is made more difficult by the fact we only get
> one chance to redirect functions.  This happens via the public
> headers.
> 
> There are roughly three classes of redirect we need to attend to
> today:
> 
>   1. Simple redirects, redirected via cdef macro overrides and
>      and new libc_hidden_ldbl_proto macro.
>   2. Internal usage of internal API, e.g __snprintf, which has
>      no direct analogue.  This is bypassed directly on case-by-
>      case basis.
>   3. Double redirects, e.g sscanf and related.  These require
>      a heavier handed approach of macro renaming to existing
>      symbols.
> 
> Most simple redirects are handled via 1.  Ideally, the libc_*
> macro would live in libc-symbols.h, but in practice the macros
> needed for it to do anything useful live in cdefs.h, so they
> are defined in the local override.
> 
> Notably, the internal name of asprintf is renamed to work with
> internal prefixed usage.
> 
> This resolves the local plt usage introduced when building glibc
> with ldbl == ieee128 on ppc64le.
> ---
>   include/err.h                                 | 12 ++---
>   include/stdio.h                               | 51 +++++++++++++------
>   include/sys/cdefs.h                           | 23 +++++++++
>   include/sys/syslog.h                          |  2 +-
>   include/wchar.h                               |  2 +-
>   .../ldbl-128ibm-compat/ieee128-asprintf.c     |  5 +-
>   .../ldbl-128ibm-compat/ieee128-dprintf.c      |  1 +
>   .../ieee754/ldbl-128ibm-compat/ieee128-err.c  |  7 +++
>   .../ldbl-128ibm-compat/ieee128-fprintf.c      |  1 +
>   .../ieee128-isoc99_sscanf.c                   |  1 +
>   .../ieee128-isoc99_vfscanf.c                  |  2 +
>   .../ieee128-isoc99_vsscanf.c                  |  1 +
>   .../ldbl-128ibm-compat/ieee128-sprintf.c      |  1 +
>   .../ldbl-128ibm-compat/ieee128-syslog.c       |  1 +
>   .../ldbl-128ibm-compat/ieee128-vfprintf.c     |  1 +
>   .../ldbl-128ibm/include/bits/iscanonical.h    |  2 +-
>   16 files changed, 87 insertions(+), 26 deletions(-)
> 

> diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
> index 524fe57a25..ae5802e744 100644
> --- a/include/sys/cdefs.h
> +++ b/include/sys/cdefs.h
> @@ -15,4 +15,27 @@ rtld_hidden_proto (__chk_fail)
> 
>   #endif
> 
> +/* If we are using redirects internally to support long double,
> +   we need to tweak some macros to ensure the PLT bypass tricks
> +   continue to work in libc. */
> +#if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) && defined SHARED
> +
> +# undef __LDBL_REDIR_DECL
> +# define __LDBL_REDIR_DECL(name)
> +
> +# undef __LDBL_REDIR2_DECL
> +# define __LDBL_REDIR2_DECL(name)
> +
> +# undef __LDBL_REDIR1_DECL
> +# define __LDBL_REDIR1_DECL(name, to)
> +
> +# define libc_hidden_ldbl_proto(func) \
> +   extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func)); \
> +   extern __typeof(func) ___ieee128_ ## func; \
> +   libc_hidden_proto (___ieee128_ ## func);
> +
> +#else
> +# define libc_hidden_ldbl_proto(func) libc_hidden_proto (func)
> +#endif
> +

I think libc_hidden_ldbl_proto(func) should be moved into libc-symbols.h 
consistent with the other libc_hidden* macros.  Similarly, these macros 
need protected against _ISOMAC.  I will post an updated patch.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv3][Ping] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-02-28 15:33         ` [PATCHv3][Ping] " Paul E Murphy
@ 2020-03-03 20:17           ` Paul E Murphy
  2020-03-06 19:37             ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Paul E Murphy @ 2020-03-03 20:17 UTC (permalink / raw)
  To: libc-alpha

I will commit this friday if there are no more requests for improvement.

On 2/28/20 9:33 AM, Paul E Murphy wrote:
> Ping.
> 
> On 2/18/20 4:00 PM, Paul E. Murphy wrote:
>> From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
>>
>> Simplify this further.  As correctly pointed out by Joseph, compiler
>> _Float128 compiler flags should always be present where needed.  Thus,
>> I can greatly simplify this patch.  It had collected too much cruft from
>> my constant rebasing.
>>
>> Likewise, defer the ppc64le makefile changes.  They really shouldn't be
>> here, and contained harmful rebasing noise.  They have been squashed
>> into later, more appropriate patches.
>>
>> Similarly, the hack for gamma is removed.  `make regen-ulps` behaves
>> as expected and fills the missing entries correctly.  The ULP changes
>> will be included with the enablement patch.
>>
>> Tested on x86-64 and ppc64le.
>>
>> ---8<---
>>
>> This patch creates test-ibm128* tests from the long double function 
>> tests.
>> In order to explicitly test IBM long double functions 
>> -mabi=ibmlongdouble is
>> added to CFLAGS.
>>
>> Likewise, update the test headers to correct choose ULPs when redirects
>> are enabled.
>>
>> Co-Authored-By: Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
>> Co-Authored-By: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
>> ---
>>   math/Makefile                                 |  7 ++++++-
>>   math/test-ibm128.h                            | 19 +++++++++++++++++++
>>   math/test-ldouble.h                           |  7 +++++++
>>   sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig |  3 +++
>>   4 files changed, 35 insertions(+), 1 deletion(-)
>>   create mode 100644 math/test-ibm128.h
>>   create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
>>
>> diff --git a/math/Makefile b/math/Makefile
>> index 1d203e7ad5..84a8b94c74 100644
>> --- a/math/Makefile
>> +++ b/math/Makefile
>> @@ -145,10 +145,15 @@ type-float128-yes := float128
>>   # _Float64x may be supported, only as an alias type.
>>   type-float64x-yes := float64x
>>
>> +# IBM long double support in additional to IEEE 128 long double support
>> +type-ibm128-suffix := l
>> +type-ibm128-yes := ibm128
>> +
>>   types = $(types-basic) $(type-float128-$(float128-fcts))
>>   test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
>>            float32 float64 $(type-float128-$(float128-alias-fcts)) \
>> -         float32x $(type-float64x-$(float64x-alias-fcts))
>> +         float32x $(type-float64x-$(float64x-alias-fcts)) \
>> +         $(type-ibm128-$(ibm128-fcts))
>>
>>   # Pairs of types for which narrowing functions should be tested (this
>>   # variable has more entries than libm-narrow-types because it includes
>> diff --git a/math/test-ibm128.h b/math/test-ibm128.h
>> new file mode 100644
>> index 0000000000..fce6ef1376
>> --- /dev/null
>> +++ b/math/test-ibm128.h
>> @@ -0,0 +1,19 @@
>> +/* Common definitions for libm tests for ibm long double.
>> +   Copyright (C) 2020 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <http://www.gnu.org/licenses/>.  */
>> +
>> +#include "test-ldouble.h"
>> diff --git a/math/test-ldouble.h b/math/test-ldouble.h
>> index 17c526bd71..5b72915008 100644
>> --- a/math/test-ldouble.h
>> +++ b/math/test-ldouble.h
>> @@ -27,6 +27,13 @@
>>   # define TYPE_STR "double"
>>   # define ULP_IDX ULP_DBL
>>   # define ULP_I_IDX ULP_I_DBL
>> +/* On architectures which redirect long double to _Float128 ABI, we must
>> +   choose the float128 ulps.  Similarly, on such architectures, the ABI
>> +   used may be dependent on how the compiler was invoked.  */
>> +#elif __LONG_DOUBLE_USES_FLOAT128 == 1
>> +# define TYPE_STR "float128"
>> +# define ULP_IDX ULP_FLT128
>> +# define ULP_I_IDX ULP_I_FLT128
>>   #else
>>   # define TYPE_STR "ldouble"
>>   # define ULP_IDX ULP_LDBL
>> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig 
>> b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
>> new file mode 100644
>> index 0000000000..997f632319
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig
>> @@ -0,0 +1,3 @@
>> +# Include this earlier so it can be used earlier in Makefiles,
>> +# and sysdep/ makefiles.
>> +ibm128-fcts = yes
>>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags
  2020-02-14 16:10 ` [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags Paul E. Murphy
@ 2020-03-03 20:18   ` Paul E Murphy
  2020-03-06 19:38     ` Paul E Murphy
  0 siblings, 1 reply; 28+ messages in thread
From: Paul E Murphy @ 2020-03-03 20:18 UTC (permalink / raw)
  To: libc-alpha

Ping.  Will commit friday if no requests for improvement.

On 2/14/20 10:10 AM, Paul E. Murphy wrote:
> From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
> 
> Soon, powerpc64le will need to provide extra compiler flags to the long
> double files in order to continue to build using the IBM 128-bit
> extended floating point type as long double.
> ---
>   sysdeps/ieee754/ldbl-128ibm/Makefile | 22 +++++++++++++++++++---
>   1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile
> index bdba6cc6b5..c38d4f6ac2 100644
> --- a/sysdeps/ieee754/ldbl-128ibm/Makefile
> +++ b/sysdeps/ieee754/ldbl-128ibm/Makefile
> @@ -9,8 +9,24 @@ tests += tst-strtold-ldbl-128ibm
>   $(objpfx)tst-strtold-ldbl-128ibm: $(libm)
>   endif
> 
> +ldbl-tests = test-fmodl-ldbl-128ibm test-remainderl-ldbl-128ibm \
> +	     test-remquol-ldbl-128ibm test-canonical-ldbl-128ibm \
> +	     test-totalorderl-ldbl-128ibm
> +
>   ifeq ($(subdir),math)
> -tests += test-fmodl-ldbl-128ibm test-remainderl-ldbl-128ibm \
> -	 test-remquol-ldbl-128ibm test-canonical-ldbl-128ibm \
> -	 test-totalorderl-ldbl-128ibm
> +tests += $(ldbl-tests)
>   endif
> +
> +# Long double files may need extra CFLAGS.
> +ldbl-128ibm-routines = s_nexttoward s_nexttowardf \
> +		       $(type-ldouble-routines) \
> +		       $(subst F,$(type-ldouble-suffix),$(libm-compat-calls)) \
> +		       $(subst F,$(type-ldouble-suffix),$(libm-calls)) \
> +		       $(subst F,$(type-ldouble-suffix),$(calls)) \
> +		       $(foreach f,$(libm-narrow-fns), \
> +				 $(subst F,$(f), \
> +					 $(libm-narrow-types-ldouble-yes)))
> +$(foreach suf,$(all-object-suffixes), \
> +	  $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
> +		    $(objpfx)$(r)$(suf))): \
> +  CFLAGS += $(type-ldouble-CFLAGS)
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv3][Ping] ldbl-128ibm-compat: Add tests for IBM long double functions
  2020-03-03 20:17           ` Paul E Murphy
@ 2020-03-06 19:37             ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-03-06 19:37 UTC (permalink / raw)
  To: libc-alpha

And committed.

On 3/3/20 2:17 PM, Paul E Murphy wrote:
> I will commit this friday if there are no more requests for improvement.
> 
> On 2/28/20 9:33 AM, Paul E Murphy wrote:
>> Ping.
>>
>> On 2/18/20 4:00 PM, Paul E. Murphy wrote:
>>> From: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
>>>
>>> Simplify this further.  As correctly pointed out by Joseph, compiler
>>> _Float128 compiler flags should always be present where needed.  Thus,
>>> I can greatly simplify this patch.  It had collected too much cruft from
>>> my constant rebasing.
>>>
>>> Likewise, defer the ppc64le makefile changes.  They really shouldn't be
>>> here, and contained harmful rebasing noise.  They have been squashed
>>> into later, more appropriate patches.
>>>
>>> Similarly, the hack for gamma is removed.  `make regen-ulps` behaves
>>> as expected and fills the missing entries correctly.  The ULP changes
>>> will be included with the enablement patch.
>>>
>>> Tested on x86-64 and ppc64le.
>>>
>>> ---8<---
>>>
>>> This patch creates test-ibm128* tests from the long double function 
>>> tests.
>>> In order to explicitly test IBM long double functions 
>>> -mabi=ibmlongdouble is
>>> added to CFLAGS.
>>>
>>> Likewise, update the test headers to correct choose ULPs when redirects
>>> are enabled.
>>>
>>> Co-Authored-By: Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
>>> Co-Authored-By: Paul E. Murphy  <murphyp@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags
  2020-03-03 20:18   ` Paul E Murphy
@ 2020-03-06 19:38     ` Paul E Murphy
  0 siblings, 0 replies; 28+ messages in thread
From: Paul E Murphy @ 2020-03-06 19:38 UTC (permalink / raw)
  To: libc-alpha

And committed.

On 3/3/20 2:18 PM, Paul E Murphy wrote:
> Ping.  Will commit friday if no requests for improvement.
> 
> On 2/14/20 10:10 AM, Paul E. Murphy wrote:
>> From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
>>
>> Soon, powerpc64le will need to provide extra compiler flags to the long
>> double files in order to continue to build using the IBM 128-bit
>> extended floating point type as long double.
>> ---
>>   sysdeps/ieee754/ldbl-128ibm/Makefile | 22 +++++++++++++++++++---
>>   1 file changed, 19 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-03-06 19:38 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 16:10 [PATCH 0/7] Remaining ldbl-128ibm-compat support Paul E. Murphy
2020-02-14 16:10 ` [PATCH 1/7] ldbl-128ibm-compat: Provide nexttoward functions Paul E. Murphy
2020-02-27 20:16   ` Tulio Magno Quites Machado Filho
2020-02-28 14:56     ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 2/7] ldbl-128ibm-compat: enforce correct abi flags on internal file Paul E. Murphy
2020-02-21 14:35   ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 3/7] ldbl-128ibm-compat: Add tests for IBM long double functions Paul E. Murphy
2020-02-14 17:31   ` Joseph Myers
2020-02-14 18:22     ` Paul E Murphy
2020-02-14 21:13       ` Joseph Myers
2020-02-17 22:06     ` [PATCHv2 " Paul E. Murphy
2020-02-17 22:24       ` Joseph Myers
2020-02-18 22:00       ` [PATCHv3] " Paul E. Murphy
2020-02-28 15:33         ` [PATCHv3][Ping] " Paul E Murphy
2020-03-03 20:17           ` Paul E Murphy
2020-03-06 19:37             ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 4/7] ldbl-128ibm-compat: fixup subdir location of several funcs Paul E. Murphy
2020-02-21 14:34   ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 5/7] ldbl-128ibm-compat: enforce ibm128 on compat tests Paul E. Murphy
2020-02-27 20:39   ` Tulio Magno Quites Machado Filho
2020-02-27 22:45     ` Paul E Murphy
2020-02-28 14:57       ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 6/7] ldbl-128ibm: Let long double files have specific compiler flags Paul E. Murphy
2020-03-03 20:18   ` Paul E Murphy
2020-03-06 19:38     ` Paul E Murphy
2020-02-14 16:10 ` [PATCH 7/7] RFC: ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally Paul E. Murphy
2020-02-27 20:58   ` Tulio Magno Quites Machado Filho
2020-02-28 17:21   ` Paul E Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).