diff mbox series

[v2,03/10] Rename __LONG_DOUBLE_USES_FLOAT128 to

Message ID 20200327211801.31234-4-murphyp@linux.vnet.ibm.com
State Superseded
Headers show
Series IEEE binary128 long double on powerpc64le | expand

Commit Message

Paul E. Murphy March 27, 2020, 9:17 p.m. UTC
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI per feedback and disucssion
on libc-alpha [2].  Likewise, add documentation to the macro
in the common bits/long-double.h header.  This is effectively
V2 of [2].

Per the feedback from Joseph [1].  Good comments and a more
self-explanatory macro name will be very helpful when this
macro is able to assume a non-zero value.

[1] <https://sourceware.org/legacy-ml/libc-alpha/2020-02/msg00687.html>
[2] <https://sourceware.org/pipermail/libc-alpha/2020-February/111148.html>

---8<---

Improve the commentary to aid future developers who will stumble
upon this novel, yet not always perfect, mechanism to support
alternative formats for long double.

Likewise, rename __LONG_DOUBLE_USES_FLOAT128 to
__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI now that development work
has settled down.  The command used was

git grep -l __LONG_DOUBLE_USES_FLOAT128 ':!./ChangeLog*' | \
  xargs sed -i 's/__LONG_DOUBLE_USES_FLOAT128/__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI/g'
---
 argp/argp.h                                       |  2 +-
 bits/long-double.h                                | 15 ++++++++++++++-
 elf/tst-addr1.c                                   |  2 +-
 include/math.h                                    |  6 +++---
 include/monetary.h                                |  2 +-
 include/printf.h                                  |  2 +-
 include/stdio.h                                   |  8 ++++----
 include/stdlib.h                                  |  4 ++--
 include/sys/cdefs.h                               |  2 +-
 include/wchar.h                                   |  2 +-
 libio/bits/stdio-ldbl.h                           |  4 ++--
 libio/stdio.h                                     |  8 ++++----
 math/complex.h                                    |  4 ++--
 math/math.h                                       | 12 ++++++------
 math/test-ldouble.h                               |  2 +-
 misc/err.h                                        |  2 +-
 misc/error.h                                      |  2 +-
 misc/sys/cdefs.h                                  |  4 ++--
 misc/sys/syslog.h                                 |  2 +-
 stdio-common/printf.h                             |  2 +-
 stdio-common/tst-vfprintf-user-type.c             |  2 +-
 stdlib/bits/stdlib-ldbl.h                         |  2 +-
 stdlib/monetary.h                                 |  2 +-
 stdlib/stdlib.h                                   |  2 +-
 sysdeps/ieee754/ldbl-128/bits/long-double.h       |  2 +-
 .../ieee754/ldbl-128ibm-compat/bits/long-double.h |  7 ++-----
 sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h    |  2 +-
 sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h    |  2 +-
 sysdeps/ieee754/ldbl-128ibm/ieee754.h             |  6 +++---
 .../ldbl-128ibm/include/bits/iscanonical.h        |  2 +-
 sysdeps/ieee754/ldbl-96/bits/long-double.h        |  2 +-
 sysdeps/ieee754/ldbl-opt/bits/long-double.h       |  2 +-
 sysdeps/mips/ieee754/bits/long-double.h           |  2 +-
 .../sysv/linux/sparc/sparc32/bits/long-double.h   |  2 +-
 .../sysv/linux/sparc/sparc64/bits/long-double.h   |  2 +-
 wcsmbs/bits/wchar-ldbl.h                          |  4 ++--
 wcsmbs/wchar.h                                    |  8 ++++----
 37 files changed, 74 insertions(+), 64 deletions(-)

Comments

Tulio Magno Quites Machado Filho April 3, 2020, 7:22 p.m. UTC | #1
"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI per feedback and disucssion

It seems the subject of the commit and the initial explanation got mixed up.

> diff --git a/bits/long-double.h b/bits/long-double.h
> index 6e16447e65..bdde78f49a 100644
> --- a/bits/long-double.h
> +++ b/bits/long-double.h
> @@ -37,4 +37,17 @@
>  #ifndef __NO_LONG_DOUBLE_MATH
>  # define __NO_LONG_DOUBLE_MATH	1
>  #endif
> -#define __LONG_DOUBLE_USES_FLOAT128 0
> +
> +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
> +   choice of the underlying ABI of long double.  It will always assume
> +   a constant value for each translation unit.
> +
> +   If the value is non-zero, any API which is parameterized by the long
> +   double type (i.e the scanf/printf family of functions or the explicitly
> +   parameterized math.h functions) will be redirected to a compatible
> +   implementation using _Float128 ABI via symbols suffixed with ieee128.
> +
> +   The mechanism this macro uses to acquire may be a function
> +   of architecture, or target specific options used to invoke the
> +   compiler.  */
> +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0

OK.

> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> index 91dddbdc8b..ef834c7748 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
> @@ -22,8 +22,5 @@
>  #  define __NO_LONG_DOUBLE_MATH		1
>  # endif
>  #endif
> -/* On platforms that reuse the _Float128 implementation for IEEE long
> -   double, access to the correct long double functions is selected based
> -   on the long double mode being used during the compilation.  On
> -   powerpc64le, this is true when -mabi=ieeelongdouble is in use.  */
> -#define __LONG_DOUBLE_USES_FLOAT128 (__LDBL_MANT_DIG__ == 113)
> +
> +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI (__LDBL_MANT_DIG__ == 113)

OK.

LGTM with a fixed subject

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

Patch

diff --git a/argp/argp.h b/argp/argp.h
index 358d9b43cd..a5b861a4d3 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -555,7 +555,7 @@  __NTH (__option_is_end (const struct argp_option *__opt))
 #endif /* Use extern inlines.  */
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/argp-ldbl.h>
 #endif
 
diff --git a/bits/long-double.h b/bits/long-double.h
index 6e16447e65..bdde78f49a 100644
--- a/bits/long-double.h
+++ b/bits/long-double.h
@@ -37,4 +37,17 @@ 
 #ifndef __NO_LONG_DOUBLE_MATH
 # define __NO_LONG_DOUBLE_MATH	1
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+
+/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
+   choice of the underlying ABI of long double.  It will always assume
+   a constant value for each translation unit.
+
+   If the value is non-zero, any API which is parameterized by the long
+   double type (i.e the scanf/printf family of functions or the explicitly
+   parameterized math.h functions) will be redirected to a compatible
+   implementation using _Float128 ABI via symbols suffixed with ieee128.
+
+   The mechanism this macro uses to acquire may be a function
+   of architecture, or target specific options used to invoke the
+   compiler.  */
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
index 27dc0f00f4..93ce669cbd 100644
--- a/elf/tst-addr1.c
+++ b/elf/tst-addr1.c
@@ -15,7 +15,7 @@  do_test (void)
   if (i.dli_sname == NULL)
     return 1;
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
   /* On architectures which redirect long double to
      _Float128 (e.g powerpc64le), printf will resolve
      to __printfieee128 due to header redirects.  There
diff --git a/include/math.h b/include/math.h
index 1b3199b3f6..3979c47400 100644
--- a/include/math.h
+++ b/include/math.h
@@ -19,7 +19,7 @@  hidden_proto (__isinff)
 hidden_proto (__isnanf)
 
 #  if !defined __NO_LONG_DOUBLE_MATH \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 hidden_proto (__finitel)
 hidden_proto (__isinfl)
 hidden_proto (__isnanl)
@@ -42,7 +42,7 @@  libm_hidden_proto (__expf)
 libm_hidden_proto (__roundeven)
 
 #  if !defined __NO_LONG_DOUBLE_MATH \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 libm_hidden_proto (__fpclassifyl)
 libm_hidden_proto (__issignalingl)
 libm_hidden_proto (__expl)
@@ -143,7 +143,7 @@  fabsf128 (_Float128 x)
   MATH_REDIRECT_LDBL (FUNC, PREFIX, ARGS)			\
   MATH_REDIRECT_F128 (FUNC, PREFIX, ARGS)
 #   if defined __NO_LONG_DOUBLE_MATH 				\
-       || __LONG_DOUBLE_USES_FLOAT128 == 1
+       || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #    define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS)
 #   else
 #    define MATH_REDIRECT_LDBL(FUNC, PREFIX, ARGS)			\
diff --git a/include/monetary.h b/include/monetary.h
index 81933a2c5e..d3e95d394d 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -2,7 +2,7 @@ 
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
diff --git a/include/printf.h b/include/printf.h
index 9e74e35678..a9490807b8 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -4,7 +4,7 @@ 
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
diff --git a/include/stdio.h b/include/stdio.h
index 517d53837f..758659f8e0 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -7,7 +7,7 @@ 
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 # include <bits/floatn.h>
-# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  pragma GCC system_header
 # endif
 
@@ -22,10 +22,10 @@ 
 /*  Some libc_hidden_ldbl_proto's do not map to a unique symbol when
     redirecting ldouble to _Float128 variants.  We can therefore safely
     directly alias them to their internal name.  */
-# if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 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
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 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)
@@ -101,7 +101,7 @@  libc_hidden_proto (__isoc99_vfscanf)
 #   define sscanf __isoc99_sscanf
 #  endif
 
-#  if __LONG_DOUBLE_USES_FLOAT128 == 1  && IS_IN (libc)
+#  if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 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;
diff --git a/include/stdlib.h b/include/stdlib.h
index 7929e45386..92b7067d8b 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -8,7 +8,7 @@ 
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 #include <bits/floatn.h>
-#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # pragma GCC system_header
 #endif
 
@@ -216,7 +216,7 @@  libc_hidden_proto (____strtoull_l_internal)
 #include <bits/floatn.h>
 libc_hidden_proto (strtof)
 libc_hidden_proto (strtod)
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 libc_hidden_proto (strtold)
 #endif
 libc_hidden_proto (strtol)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 9f44ac5a0a..6a76160ed4 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -16,7 +16,7 @@  rtld_hidden_proto (__chk_fail)
 /* 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
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
 
 # undef __LDBL_REDIR_DECL
 # define __LDBL_REDIR_DECL(func) \
diff --git a/include/wchar.h b/include/wchar.h
index 64355dd6fb..bd59d3c109 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -4,7 +4,7 @@ 
    headers.   glibc builds some C++ tests which use these headers which do
    not get marked as system headers.  */
 # include <bits/floatn.h>
-# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  pragma GCC system_header
 # endif
 
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
index 3bb9f7dd2c..28c44666e3 100644
--- a/libio/bits/stdio-ldbl.h
+++ b/libio/bits/stdio-ldbl.h
@@ -31,7 +31,7 @@  __LDBL_REDIR_DECL (vsprintf)
 __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
 __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
 __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (fscanf, __isoc99_fscanfieee128)
 __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
 __LDBL_REDIR1_DECL (sscanf, __isoc99_sscanfieee128)
@@ -55,7 +55,7 @@  __LDBL_REDIR_DECL (vsnprintf)
 __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
 __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
 __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (vfscanf, __isoc99_vfscanfieee128)
 __LDBL_REDIR1_DECL (vscanf, __isoc99_vscanfieee128)
 __LDBL_REDIR1_DECL (vsscanf, __isoc99_vsscanfieee128)
diff --git a/libio/stdio.h b/libio/stdio.h
index 18e29752c4..21ef36ae70 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -401,11 +401,11 @@  extern int sscanf (const char *__restrict __s,
 
 /* For historical reasons, the C99-compliant versions of the scanf
    functions are at alternative names.  When __LDBL_COMPAT or
-   __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
    bits/stdio-ldbl.h.  */
 #include <bits/floatn.h>
 #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-    && __LONG_DOUBLE_USES_FLOAT128 == 0
+    && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 # ifdef __REDIRECT
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
 				const char *__restrict __format, ...),
@@ -451,7 +451,7 @@  extern int vsscanf (const char *__restrict __s,
 /* Same redirection as above for the v*scanf family.  */
 # if !__GLIBC_USE (DEPRECATED_SCANF)
 #  if defined __REDIRECT && !defined __LDBL_COMPAT \
-      && __LONG_DOUBLE_USES_FLOAT128 == 0
+      && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 extern int __REDIRECT (vfscanf,
 		       (FILE *__restrict __s,
 			const char *__restrict __format, __gnuc_va_list __arg),
@@ -872,7 +872,7 @@  extern int __overflow (FILE *, int);
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/stdio-ldbl.h>
 #endif
 
diff --git a/math/complex.h b/math/complex.h
index b6d175e800..7c06add10c 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -126,7 +126,7 @@  __BEGIN_DECLS
 #  undef __MATHDECL_1
 #  define __MATHDECL_1(type, function, args) \
   extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHDECL_1
 #  undef __MATHDECL
 #  define __REDIR_TO(function) \
@@ -142,7 +142,7 @@  __BEGIN_DECLS
 # define __MATH_PRECNAME(name)	name##l
 # include <bits/cmathcalls.h>
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __REDIR_TO
 #  undef __MATHDECL_1
 #  undef __MATHDECL
diff --git a/math/math.h b/math/math.h
index 5c3dcb9194..baa2e5e11b 100644
--- a/math/math.h
+++ b/math/math.h
@@ -343,7 +343,7 @@  extern long double __REDIRECT_NTH (nexttowardl,
 #   define __MATHDECL_1(type, function,suffix, args) \
   __MATHREDIR(type, function, suffix, args, __CONCAT(function,suffix))
 
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #   ifdef __REDIRECT_NTH
 #    ifdef __USE_ISOC99
 extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
@@ -390,7 +390,7 @@  extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATH_DECLARING_FLOATN
 
 #  if defined __LDBL_COMPAT \
-      || __LONG_DOUBLE_USES_FLOAT128 == 1
+      || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #   undef __REDIRTO
 #   undef __REDIRTO_ALT
 #   undef __MATHDECL_1
@@ -562,7 +562,7 @@  extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
   __MATHCALL_NARROW_REDIR (func, redir, nargs)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  define __MATHCALL_REDIR_NAME(name) __ ## f32 ## name ## ieee128
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -573,7 +573,7 @@  extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 # undef _Marg_
 # undef __MATHCALL_NAME
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHCALL_REDIR_NAME
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -588,7 +588,7 @@  extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
   __MATHCALL_NARROW_REDIR (func, redir, nargs)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  define __MATHCALL_REDIR_NAME(name) __ ## f64 ## name ## ieee128
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
@@ -599,7 +599,7 @@  extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 # undef _Marg_
 # undef __MATHCALL_NAME
 # if defined __LDBL_COMPAT \
-     || __LONG_DOUBLE_USES_FLOAT128 == 1
+     || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 #  undef __MATHCALL_REDIR_NAME
 #  undef __MATHCALL_NARROW
 #  define __MATHCALL_NARROW(func, redir, nargs) \
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index b9ef6f41f9..3d62c92e14 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -29,7 +29,7 @@ 
 /* 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
+#elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # define TYPE_STR "float128"
 # define ULP_IDX ULP_FLT128
 #else
diff --git a/misc/err.h b/misc/err.h
index d146a55054..e56cd73c0e 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -53,7 +53,7 @@  extern void verrx (int __status, const char *, __gnuc_va_list)
      __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/err-ldbl.h>
 #endif
 
diff --git a/misc/error.h b/misc/error.h
index bb8a3b26a4..41d54c568f 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -48,7 +48,7 @@  extern unsigned int error_message_count;
 extern int error_one_per_line;
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/error-ldbl.h>
 #else
 /* Do not inline error and error_at_line when long double has the same
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index dd5f69f833..9fa371ab86 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -452,7 +452,7 @@ 
 #include <bits/wordsize.h>
 #include <bits/long-double.h>
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # ifdef __REDIRECT
 
 /* Alias name defined automatically.  */
@@ -503,7 +503,7 @@  _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
   __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
 # endif
 #endif
-#if (!defined __LDBL_COMPAT && __LONG_DOUBLE_USES_FLOAT128 == 0) \
+#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
     || !defined __REDIRECT
 # define __LDBL_REDIR1(name, proto, alias) name proto
 # define __LDBL_REDIR(name, proto) name proto
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index c000b8e915..dc3b0e7ef8 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -208,7 +208,7 @@  extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/syslog-ldbl.h>
 #endif
 
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index 00bedebfdb..7dccfcd6fb 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -183,7 +183,7 @@  extern int printf_size_info (const struct printf_info *__restrict
      __THROW;
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/printf-ldbl.h>
 #endif
 
diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c
index 40d714fdb1..0abd61cea3 100644
--- a/stdio-common/tst-vfprintf-user-type.c
+++ b/stdio-common/tst-vfprintf-user-type.c
@@ -147,7 +147,7 @@  do_test (void)
 
   /* Alias declaration for asprintf, to avoid the format string
      attribute and the associated warning.  */
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
   extern int asprintf_alias (char **, const char *, ...) __asm__ ("__asprintfieee128");
 #else
   extern int asprintf_alias (char **, const char *, ...) __asm__ ("asprintf");
diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h
index 2469474532..cc8831dd16 100644
--- a/stdlib/bits/stdlib-ldbl.h
+++ b/stdlib/bits/stdlib-ldbl.h
@@ -51,7 +51,7 @@  __LDBL_REDIR1_DECL (qfcvt, fcvt)
 __LDBL_REDIR1_DECL (qgcvt, gcvt)
 __LDBL_REDIR1_DECL (qecvt_r, ecvt_r)
 __LDBL_REDIR1_DECL (qfcvt_r, fcvt_r)
-# elif __LONG_DOUBLE_USES_FLOAT128 == 1
+# elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (qecvt, __qecvtieee128)
 __LDBL_REDIR1_DECL (qfcvt, __qfcvtieee128)
 __LDBL_REDIR1_DECL (qgcvt, __qgcvtieee128)
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index 4a6d61fd2d..c9d3c64e14 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -51,7 +51,7 @@  extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize,
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/monetary-ldbl.h>
 #endif
 
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index a7c0c71a80..9b7537c545 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1018,7 +1018,7 @@  extern int ttyslot (void) __THROW;
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/stdlib-ldbl.h>
 #endif
 
diff --git a/sysdeps/ieee754/ldbl-128/bits/long-double.h b/sysdeps/ieee754/ldbl-128/bits/long-double.h
index 941e60505f..dd64a06db6 100644
--- a/sysdeps/ieee754/ldbl-128/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-128/bits/long-double.h
@@ -18,4 +18,4 @@ 
 
 /* long double is distinct from double, so there is nothing to
    define here.  */
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
index 91dddbdc8b..ef834c7748 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/bits/long-double.h
@@ -22,8 +22,5 @@ 
 #  define __NO_LONG_DOUBLE_MATH		1
 # endif
 #endif
-/* On platforms that reuse the _Float128 implementation for IEEE long
-   double, access to the correct long double functions is selected based
-   on the long double mode being used during the compilation.  On
-   powerpc64le, this is true when -mabi=ieeelongdouble is in use.  */
-#define __LONG_DOUBLE_USES_FLOAT128 (__LDBL_MANT_DIG__ == 113)
+
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI (__LDBL_MANT_DIG__ == 113)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
index 352617e178..5490b400dd 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/math_ldbl.h
@@ -23,7 +23,7 @@ 
 
 /* Trampoline in the ldbl-128ibm headers if building against the
    old abi.  Otherwise, we have nothing to add. */
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #include_next <math_ldbl.h>
 #endif
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
index b2021b5d64..e60b3017eb 100644
--- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
+++ b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
@@ -20,7 +20,7 @@ 
 # error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
 #endif
 
-#if defined (__NO_LONG_DOUBLE_MATH) || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined (__NO_LONG_DOUBLE_MATH) || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # define iscanonical(x) ((void) (__typeof (x)) (x), 1)
 #else
 extern int __iscanonicall (long double __x)
diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
index fe4892d84f..b66e3b9869 100644
--- a/sysdeps/ieee754/ldbl-128ibm/ieee754.h
+++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -112,7 +112,7 @@  union ieee754_double
 #define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
 
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 1
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 /* long double is IEEE 128 bit */
 union ieee854_long_double
   {
@@ -170,7 +170,7 @@  union ieee854_long_double
 #endif
 
 
-#if __LONG_DOUBLE_USES_FLOAT128 == 0 || __GNUC_PREREQ (7, 0)
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 || __GNUC_PREREQ (7, 0)
 /* IBM extended format for long double.
 
    Each long double is made up of two IEEE doubles.  The value of the
@@ -183,7 +183,7 @@  union ieee854_long_double
    NaN is don't-care.  */
 union ibm_extended_long_double
   {
-# if __LONG_DOUBLE_USES_FLOAT128 == 1 && __GNUC_PREREQ (7, 0)
+# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && __GNUC_PREREQ (7, 0)
    __ibm128 ld;
 # else
    long double ld;
diff --git a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h
index 8cbd6f74bf..60d5417089 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>
 
-#if !defined _ISOMAC && (__LONG_DOUBLE_USES_FLOAT128 == 0)
+#if !defined _ISOMAC && (__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0)
 libm_hidden_proto (__iscanonicall)
 #endif
diff --git a/sysdeps/ieee754/ldbl-96/bits/long-double.h b/sysdeps/ieee754/ldbl-96/bits/long-double.h
index b77124f842..9a2cd0dfe4 100644
--- a/sysdeps/ieee754/ldbl-96/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-96/bits/long-double.h
@@ -18,4 +18,4 @@ 
 
 /* long double is distinct from double, so there is nothing to
    define here.  */
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/ieee754/ldbl-opt/bits/long-double.h b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
index 242e58410d..48688ad7e1 100644
--- a/sysdeps/ieee754/ldbl-opt/bits/long-double.h
+++ b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
@@ -22,4 +22,4 @@ 
 #  define __NO_LONG_DOUBLE_MATH		1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/mips/ieee754/bits/long-double.h b/sysdeps/mips/ieee754/bits/long-double.h
index 57007a84d6..1ad74e4497 100644
--- a/sysdeps/mips/ieee754/bits/long-double.h
+++ b/sysdeps/mips/ieee754/bits/long-double.h
@@ -21,4 +21,4 @@ 
 #if !defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
 # define __NO_LONG_DOUBLE_MATH	1
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
index 7046cd40d7..107c5d179b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h
@@ -24,4 +24,4 @@ 
 #  define __NO_LONG_DOUBLE_MATH        1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
index 7046cd40d7..107c5d179b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h
@@ -24,4 +24,4 @@ 
 #  define __NO_LONG_DOUBLE_MATH        1
 # endif
 #endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
index 75d547f680..1b063d1235 100644
--- a/wcsmbs/bits/wchar-ldbl.h
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -32,7 +32,7 @@  __LDBL_REDIR_DECL (vswprintf);
 __LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
 __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
 __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (fwscanf, __isoc99_fwscanfieee128)
 __LDBL_REDIR1_DECL (wscanf, __isoc99_wscanfieee128)
 __LDBL_REDIR1_DECL (swscanf, __isoc99_swscanfieee128)
@@ -57,7 +57,7 @@  __LDBL_REDIR1_DECL (wcstold, __wcstoieee128)
 __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
 __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
 __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
-#  elif __LONG_DOUBLE_USES_FLOAT128 == 1
+#  elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 __LDBL_REDIR1_DECL (vfwscanf, __isoc99_vfwscanfieee128)
 __LDBL_REDIR1_DECL (vwscanf, __isoc99_vwscanfieee128)
 __LDBL_REDIR1_DECL (vswscanf, __isoc99_vswscanfieee128)
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index fb2cec8167..9cf8b05a87 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -634,10 +634,10 @@  extern int swscanf (const wchar_t *__restrict __s,
 
 /* For historical reasons, the C99-compliant versions of the scanf
    functions are at alternative names.  When __LDBL_COMPAT or
-   __LONG_DOUBLE_USES_FLOAT128 are in effect, this is handled in
+   __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
    bits/wchar-ldbl.h.  */
 #if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \
-     && __LONG_DOUBLE_USES_FLOAT128 == 0
+     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #  ifdef __REDIRECT
 extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
 				 const wchar_t *__restrict __format, ...),
@@ -691,7 +691,7 @@  extern int vswscanf (const wchar_t *__restrict __s,
 # if !__GLIBC_USE (DEPRECATED_SCANF) \
      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \
-     && __LONG_DOUBLE_USES_FLOAT128 == 0
+     && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
 #  ifdef __REDIRECT
 extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
 				  const wchar_t *__restrict __format,
@@ -853,7 +853,7 @@  extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 #endif
 
 #include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LONG_DOUBLE_USES_FLOAT128 == 1
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
 # include <bits/wchar-ldbl.h>
 #endif