about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/le
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-03-09 16:59:14 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-04-27 16:32:01 -0300
commit3a33b0696937d3c8324e517512f8dc952166a7ab (patch)
treebd3db4fedb5ea7b1d996a57335cba9613533c514 /sysdeps/powerpc/powerpc64/le
parenta3fb6b6bc3f2f33e93f4c9575105f3b5f39cb201 (diff)
downloadglibc-3a33b0696937d3c8324e517512f8dc952166a7ab.tar.gz
glibc-3a33b0696937d3c8324e517512f8dc952166a7ab.tar.xz
glibc-3a33b0696937d3c8324e517512f8dc952166a7ab.zip
powerpc64*: fix the order of implied sysdeps directories
The creation of the divergent sysdeps directory for powerpc64le

commit 2f7f3cd8cd302bb10908c86f3f7b349df0a78e6a
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 15 18:04:40 2016 -0500

    powerpc64le: Create divergent sysdep directory for powerpc64le.

allowed float128 to be enabled for powerpc64le (little-endian) and not
for powerpc64 (big-endian).  Since the only intended difference between
them was the presence or absence of the float128 interface, the sysdeps
directory for powerpc64le explicitly reused the files from powerpc64
(through the use of Implies files).

Although this works, it also means that files under the powerpc64
directory might be preferred over files under powerpc64le.  For
instance, on a build for powerpc64le with target set to power9, a file
from powerpc64/power5 might get built, even though a file with the same
name exists in powerpc64le/power8.  That happens because the processor
hierarchy was only defined in the sysdeps directory for powerpc64 (and
borrowed by powerpc64le).

This patch fixes this behavior, by creating new subdirectories under
powerpc64 (i.e.: powerpc64/be and powerpc64/le) and creating new Implies
files to provide the hierarchy of processors for powerpc64 and
powerpc64le separately.  These changes have no effect on installed,
stripped binaries (which remain unchanged).

Tested that installed stripped binaries are unchanged and that there are
no regressions on powerpc64 and powerpc64le.
Diffstat (limited to 'sysdeps/powerpc/powerpc64/le')
-rw-r--r--sysdeps/powerpc/powerpc64/le/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/Implies-before1
-rw-r--r--sysdeps/powerpc/powerpc64/le/Makefile81
-rw-r--r--sysdeps/powerpc/powerpc64/le/configure75
-rw-r--r--sysdeps/powerpc/powerpc64/le/configure.ac48
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c51
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h115
-rw-r--r--sysdeps/powerpc/powerpc64/le/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power7/Implies13
-rw-r--r--sysdeps/powerpc/powerpc64/le/power7/fpu/Implies5
-rw-r--r--sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power7/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power8/Implies2
-rw-r--r--sysdeps/powerpc/powerpc64/le/power8/fpu/Implies2
-rw-r--r--sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power8/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power9/Implies2
-rw-r--r--sysdeps/powerpc/powerpc64/le/power9/fpu/Implies2
-rw-r--r--sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c36
-rw-r--r--sysdeps/powerpc/powerpc64/le/power9/fpu/multiarch/Implies1
-rw-r--r--sysdeps/powerpc/powerpc64/le/power9/multiarch/Implies1
23 files changed, 443 insertions, 0 deletions
diff --git a/sysdeps/powerpc/powerpc64/le/Implies b/sysdeps/powerpc/powerpc64/le/Implies
new file mode 100644
index 0000000000..a105a325f7
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64
diff --git a/sysdeps/powerpc/powerpc64/le/Implies-before b/sysdeps/powerpc/powerpc64/le/Implies-before
new file mode 100644
index 0000000000..48065141a9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/Implies-before
@@ -0,0 +1 @@
+ieee754/float128
diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
new file mode 100644
index 0000000000..14d39e28b1
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -0,0 +1,81 @@
+# When building float128 we need to ensure -mfloat128 is
+# passed to all such object files.
+
+# libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built with
+# a binary128 type.  That symbol is provided by the loader on dynamically
+# linked executables, forcing to link the loader after libgcc link.
+f128-loader-link = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
+
+ifeq ($(subdir),math)
+# sqrtf128 requires emulation before POWER9.
+CPPFLAGS += -I../soft-fp
+
+# float128 requires adding a handful of extra flags.
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf)): CFLAGS += -mfloat128
+# Pairs of types with _Float128 / _Float64x as the wider type but not
+# the narrower one.
+f128-pairs = float32-float64x float32-float128 float64-float64x \
+	     float64-float128 float32x-float64x float32x-float128
+$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += -mfloat128
+CFLAGS-libm-test-support-float128.c += -mfloat128
+CFLAGS-libm-test-support-float64x.c += -mfloat128
+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)): \
+  gnulib-tests += $(f128-loader-link)
+endif
+
+# Append flags to string <-> _Float128 routines.
+ifneq ($(filter $(subdir),wcsmbs stdlib),)
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128
+$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128
+CFLAGS-bug-strtod.c += -mfloat128
+CFLAGS-bug-strtod2.c += -mfloat128
+CFLAGS-tst-strtod-round.c += -mfloat128
+CFLAGS-tst-wcstod-round.c += -mfloat128
+CFLAGS-tst-strtod-nan-locale.c += -mfloat128
+CFLAGS-tst-wcstod-nan-locale.c += -mfloat128
+CFLAGS-tst-strtod6.c += -mfloat128
+CFLAGS-tst-strfrom.c += -mfloat128
+CFLAGS-tst-strfrom-locale.c += -mfloat128
+CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
+tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
+tst-strtod-nan-locale tst-wcstod-nan-locale \
+strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
+
+# When building glibc with support for _Float128, the powers of ten tables in
+# fpioconst.c and in the string conversion functions must be extended.  Some
+# Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in
+# sysdeps.  This is avoided with the use sysdep-CFLAGS instead of CFLAGS.
+sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F))
+sysdep-CFLAGS-fpioconst.c += -mfloat128
+sysdep-CFLAGS-strtod_l.c += -mfloat128
+sysdep-CFLAGS-strtof_l.c += -mfloat128
+sysdep-CFLAGS-strtold_l.c += -mfloat128
+sysdep-CFLAGS-wcstod_l.c += -mfloat128
+sysdep-CFLAGS-wcstof_l.c += -mfloat128
+sysdep-CFLAGS-wcstold_l.c += -mfloat128
+endif
+
+# Append flags to printf routines.
+ifeq ($(subdir),stdio-common)
+CFLAGS-printf_fp.c = -mfloat128
+CFLAGS-printf_fphex.c = -mfloat128
+CFLAGS-printf_size.c = -mfloat128
+endif
diff --git a/sysdeps/powerpc/powerpc64/le/configure b/sysdeps/powerpc/powerpc64/le/configure
new file mode 100644
index 0000000000..66bb5dcc1a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/configure
@@ -0,0 +1,75 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/powerpc/powerpc64le.
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports binary128 floating point type" >&5
+$as_echo_n "checking if $CC supports binary128 floating point type... " >&6; }
+if ${libc_cv_compiler_powerpc64le_binary128_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -mfloat128"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 a, b, c, d, e;
+int i;
+
+__float128
+foobar (__float128 x)
+{
+  a = __builtin_nansq ("0");
+  b = __builtin_huge_valq ();
+  c = __builtin_infq ();
+  d = __builtin_fabsq (x);
+  e = __builtin_nanq ("0");
+  i = __builtin_signbit (x);
+  return __builtin_copysignq (x, x);
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_powerpc64le_binary128_ok=yes
+else
+  libc_cv_compiler_powerpc64le_binary128_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_powerpc64le_binary128_ok" >&5
+$as_echo "$libc_cv_compiler_powerpc64le_binary128_ok" >&6; }
+if test "$libc_cv_compiler_powerpc64le_binary128_ok" != "yes"; then :
+  critic_missing="$critic_missing binary128 floating point type (GCC >= 6.2) is required on powerpc64le."
+fi
+
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $libc_cv_cc_submachine"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the target machine is at least POWER8" >&5
+$as_echo_n "checking if the target machine is at least POWER8... " >&6; }
+if ${libc_cv_target_power8_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef _ARCH_PWR8
+#error invalid target architecture
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_target_power8_ok=yes
+else
+  libc_cv_target_power8_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_target_power8_ok" >&5
+$as_echo "$libc_cv_target_power8_ok" >&6; }
+if test "$libc_cv_target_power8_ok" != "yes"; then :
+  critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."
+fi
+CFLAGS="$OLD_CFLAGS"
+
+test -n "$critic_missing" && as_fn_error $? "*** $critic_missing" "$LINENO" 5
diff --git a/sysdeps/powerpc/powerpc64/le/configure.ac b/sysdeps/powerpc/powerpc64/le/configure.ac
new file mode 100644
index 0000000000..20a49d89e8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/configure.ac
@@ -0,0 +1,48 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/powerpc/powerpc64le.
+
+dnl Require binary128 floating point support on powerpc64le (available in
+dnl GCC 6.2).
+AC_CACHE_CHECK([if $CC supports binary128 floating point type],
+	       libc_cv_compiler_powerpc64le_binary128_ok, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -mfloat128"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+__float128 a, b, c, d, e;
+int i;
+
+__float128
+foobar (__float128 x)
+{
+  a = __builtin_nansq ("0");
+  b = __builtin_huge_valq ();
+  c = __builtin_infq ();
+  d = __builtin_fabsq (x);
+  e = __builtin_nanq ("0");
+  i = __builtin_signbit (x);
+  return __builtin_copysignq (x, x);
+}
+]])],
+		  [libc_cv_compiler_powerpc64le_binary128_ok=yes],
+		  [libc_cv_compiler_powerpc64le_binary128_ok=no])
+CFLAGS="$save_CFLAGS"])
+AS_IF([test "$libc_cv_compiler_powerpc64le_binary128_ok" != "yes"],
+      [critic_missing="$critic_missing binary128 floating point type (GCC >= 6.2) is required on powerpc64le."])
+
+dnl Require at least POWER8 on powerpc64le
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $libc_cv_cc_submachine"
+AC_CACHE_CHECK([if the target machine is at least POWER8],
+	       libc_cv_target_power8_ok, [
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifndef _ARCH_PWR8
+#error invalid target architecture
+#endif
+]])],
+	       [libc_cv_target_power8_ok=yes],
+	       [libc_cv_target_power8_ok=no])])
+AS_IF([test "$libc_cv_target_power8_ok" != "yes"],
+      [critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."])
+CFLAGS="$OLD_CFLAGS"
+
+test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/Implies b/sysdeps/powerpc/powerpc64/le/fpu/Implies
new file mode 100644
index 0000000000..c1f617b7da
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/fpu
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c
new file mode 100644
index 0000000000..0ff897bef3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c
@@ -0,0 +1,51 @@
+/* soft-fp sqrt for _Float128
+   Return sqrt(a)
+   Copyright (C) 2017-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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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/>.  */
+
+/* Unavoidable hacks since TFmode is assumed to be binary128. */
+#define TFtype KFtype
+#define TF KF
+
+#include <soft-fp.h>
+#include <quad.h>
+
+__float128
+__ieee754_sqrtf128 (__float128 a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q (A);
+  FP_DECL_Q (R);
+  __float128 r;
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_Q (A, a);
+  FP_SQRT_Q (R, A);
+  FP_PACK_Q (r, R);
+  FP_HANDLE_EXCEPTIONS;
+  return r;
+}
+strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Implies
new file mode 100644
index 0000000000..8d6531a174
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/fpu/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h b/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h
new file mode 100644
index 0000000000..fac5dd0347
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h
@@ -0,0 +1,115 @@
+#define _FP_W_TYPE_SIZE		64
+#define _FP_W_TYPE		unsigned long long
+#define _FP_WS_TYPE		signed long long
+#define _FP_I_TYPE		long long
+
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+
+#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
+
+/* The type of the result of a floating point comparison.  This must
+   match `__libgcc_cmp_return__' in GCC for the target.  */
+typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
+#define CMPtype __gcc_CMPtype
+
+#define _FP_MUL_MEAT_S(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+
+#define _FP_MUL_MEAT_D(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y)				\
+  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
+
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_Q(R,X,Y)   _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
+
+#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1)
+#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1
+
+#define _FP_NANSIGN_S		0
+#define _FP_NANSIGN_D		0
+#define _FP_NANSIGN_Q		0
+
+#define _FP_KEEPNANFRACP 1
+#define _FP_QNANNEGATEDP 0
+
+/* Someone please check this.  */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
+	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
+      {								\
+	R##_s = Y##_s;						\
+	_FP_FRAC_COPY_##wc(R,Y);				\
+      }								\
+    else							\
+      {								\
+	R##_s = X##_s;						\
+	_FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
+  } while (0)
+
+#define _FP_TININESS_AFTER_ROUNDING 0
+
+#define	__LITTLE_ENDIAN	1234
+#define	__BIG_ENDIAN	4321
+#define	__BYTE_ORDER	__LITTLE_ENDIAN
+
+/* Only provide exception support if we have hardware floating point using
+   floating point registers and we can execute the mtfsf instruction.  This
+   would only be true if we are using the emulation routines for IEEE 128-bit
+   floating point on pre-ISA 3.0 machines without the IEEE 128-bit floating
+   point support.  */
+
+#ifdef __FLOAT128__
+#define ISA_BIT(x) (1LL << (63 - x))
+
+/* Use the same bits of the FPSCR.  */
+# define FP_EX_INVALID		ISA_BIT(34)
+# define FP_EX_OVERFLOW		ISA_BIT(35)
+# define FP_EX_UNDERFLOW	ISA_BIT(36)
+# define FP_EX_DIVZERO		ISA_BIT(37)
+# define FP_EX_INEXACT		ISA_BIT(38)
+# define FP_EX_ALL		(FP_EX_INVALID | FP_EX_OVERFLOW		\
+				 | FP_EX_UNDERFLOW | FP_EX_DIVZERO	\
+				 | FP_EX_INEXACT)
+
+void __sfp_handle_exceptions (int);
+
+# define FP_HANDLE_EXCEPTIONS			\
+  do {						\
+    if (__builtin_expect (_fex, 0))		\
+      __sfp_handle_exceptions (_fex);		\
+  } while (0);
+
+/* The FP_EX_* bits track whether the exception has occurred.  This macro
+   must set the FP_EX_* bits of those exceptions which are configured to
+   trap.  The FPSCR bit which indicates this is 22 ISA bits above the
+   respective FP_EX_* bit.  Note, the ISA labels bits from msb to lsb,
+   so 22 ISA bits above is 22 bits below when counted from the lsb.  */
+# define FP_TRAPPING_EXCEPTIONS ((_fpscr.i << 22) & FP_EX_ALL)
+
+# define FP_RND_NEAREST	0x0
+# define FP_RND_ZERO	0x1
+# define FP_RND_PINF	0x2
+# define FP_RND_MINF	0x3
+# define FP_RND_MASK	0x3
+
+# define _FP_DECL_EX \
+  union { unsigned long long i; double d; } _fpscr __attribute__ ((unused)) = \
+	{ .i = FP_RND_NEAREST }
+
+#define FP_INIT_ROUNDMODE			\
+  do {						\
+    __asm__ __volatile__ ("mffs %0"		\
+			  : "=f" (_fpscr.d));	\
+  } while (0)
+
+# define FP_ROUNDMODE	(_fpscr.i & FP_RND_MASK)
+#endif	/* !__FLOAT128__ */
diff --git a/sysdeps/powerpc/powerpc64/le/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/multiarch/Implies
new file mode 100644
index 0000000000..30edcf7f9d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power7/Implies b/sysdeps/powerpc/powerpc64/le/power7/Implies
new file mode 100644
index 0000000000..5763968694
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power7/Implies
@@ -0,0 +1,13 @@
+powerpc/powerpc64/power7
+powerpc/powerpc64/power6/fpu
+powerpc/powerpc64/power6
+powerpc/powerpc64/power5+/fpu
+powerpc/powerpc64/power5+
+powerpc/power5+/fpu
+powerpc/power5+
+powerpc/powerpc64/power5/fpu
+powerpc/powerpc64/power5
+powerpc/powerpc64/power4
+powerpc/power4/fpu
+powerpc/power4
+powerpc/powerpc64/le
diff --git a/sysdeps/powerpc/powerpc64/le/power7/fpu/Implies b/sysdeps/powerpc/powerpc64/le/power7/fpu/Implies
new file mode 100644
index 0000000000..27eb299ef0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power7/fpu/Implies
@@ -0,0 +1,5 @@
+powerpc/powerpc64/power7/fpu
+powerpc/powerpc64/power6/fpu
+powerpc/powerpc64/power5+/fpu
+powerpc/powerpc64/power5/fpu
+powerpc/powerpc64/le/fpu
diff --git a/sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch/Implies
new file mode 100644
index 0000000000..f9b3a92c33
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/fpu/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power7/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power7/multiarch/Implies
new file mode 100644
index 0000000000..87b32a21ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power7/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power8/Implies b/sysdeps/powerpc/powerpc64/le/power8/Implies
new file mode 100644
index 0000000000..6c3fc78ce1
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power8/Implies
@@ -0,0 +1,2 @@
+powerpc/powerpc64/power8
+powerpc/powerpc64/le/power7
diff --git a/sysdeps/powerpc/powerpc64/le/power8/fpu/Implies b/sysdeps/powerpc/powerpc64/le/power8/fpu/Implies
new file mode 100644
index 0000000000..be3c5157b9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power8/fpu/Implies
@@ -0,0 +1,2 @@
+powerpc/powerpc64/power8/fpu
+powerpc/powerpc64/le/power7/fpu
diff --git a/sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch/Implies
new file mode 100644
index 0000000000..36c05ff34a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/power7/fpu/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power8/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power8/multiarch/Implies
new file mode 100644
index 0000000000..0057194b12
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power8/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/power7/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power9/Implies b/sysdeps/powerpc/powerpc64/le/power9/Implies
new file mode 100644
index 0000000000..8c0cfd7c2e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power9/Implies
@@ -0,0 +1,2 @@
+powerpc/powerpc64/power9
+powerpc/powerpc64/le/power8
diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/Implies b/sysdeps/powerpc/powerpc64/le/power9/fpu/Implies
new file mode 100644
index 0000000000..8b7c0b4af6
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power9/fpu/Implies
@@ -0,0 +1,2 @@
+powerpc/powerpc64/power9/fpu
+powerpc/powerpc64/le/power8/fpu
diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c
new file mode 100644
index 0000000000..76ab451dbb
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c
@@ -0,0 +1,36 @@
+/* POWER9 sqrt for _Float128
+   Return sqrt(a)
+   Copyright (C) 2017-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.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
+   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/>.  */
+
+__float128
+__ieee754_sqrtf128 (__float128 a)
+{
+  __float128 z;
+  asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a));
+  return z;
+}
+strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power9/fpu/multiarch/Implies
new file mode 100644
index 0000000000..dce5bca13e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power9/fpu/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/power8/fpu/multiarch
diff --git a/sysdeps/powerpc/powerpc64/le/power9/multiarch/Implies b/sysdeps/powerpc/powerpc64/le/power9/multiarch/Implies
new file mode 100644
index 0000000000..98efd68e54
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power9/multiarch/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/le/power8/multiarch