7c0489
commit 6cac323c8dd78668e65aaa29f044cbd33c1a66a5
7c0489
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7c0489
Date:   Fri Mar 15 18:42:00 2019 +0000
7c0489
7c0489
    powerpc: ceil/ceilf refactor
7c0489
    
7c0489
    This patches consolidates all the powerpc ceil{f} implementations on
7c0489
    the generic sysdeps/powerpc/fpu/s_ceil{f}.  The generic implementation
7c0489
    uses either the compiler builts for ISA 2.03+ (which generates the frip
7c0489
    instruction) or a generic implementation which uses FP only operations.
7c0489
    
7c0489
    It adds a generic implementation (round_to_integer.h) which is shared
7c0489
    with other rounding to integer routines.  The resulting code should be
7c0489
    similar in term os performance to previous assembly one.
7c0489
    
7c0489
    The IFUNC organization for powerpc64 is also change to be enabled only
7c0489
    for powerpc64 and not for powerpc64le (since minium ISA of 2.08 does not
7c0489
    require the fallback generic implementation).
7c0489
    
7c0489
    Checked on powerpc-linux-gnu (built without --with-cpu, with
7c0489
    --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
7c0489
    powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
7c0489
    and --disable-multi-arch).
7c0489
    
7c0489
            * sysdeps/powerpc/fpu/fenv_libc.h (__fesetround_inline_nocheck): New
7c0489
            function.
7c0489
            * sysdeps/powerpc/fpu/round_to_integer.h: New file.
7c0489
            * sysdeps/powerpc/fpu/s_ceil.c: Likewise.
7c0489
            * sysdeps/powerpc/fpu/s_ceilf.c: Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Remove file.
7c0489
            * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
7c0489
            (CFLAGS-s_ceil-power5+.c, CFLAGS-s_ceilf-power5+.c): New rule.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S:
7c0489
            Remove file.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c:
7c0489
            New file.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Remove file.
7c0489
            * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile: New file.
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Move to ...
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c: ... here.
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c: New
7c0489
            file.
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c:
7c0489
            Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Move to ...
7c0489
            * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c: ...
7c0489
            * here.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
7c0489
            (libm-sysdep_routines): Remove s_ceil-power5+, s_ceil-ppc64,
7c0489
            s_ceilf-power5+, and s_ceilf-ppc64.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Remove
7c0489
            file.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
7c0489
            * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
7c0489
    
7c0489
    Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
7c0489
7c0489
Conflicts:
7c0489
	sysdeps/powerpc/powerpc32/fpu/s_ceil.S
7c0489
	sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
7c0489
	sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
7c0489
	sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
7c0489
	sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
7c0489
	sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
7c0489
	sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
7c0489
	sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/s_ceil.S
7c0489
	sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
7c0489
	sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
7c0489
	sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
7c0489
	  (Removal after the copyright year header change upstream.)
7c0489
7c0489
diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
7c0489
index 4c19d12b0b31c1f9..a0128c66444a3e46 100644
7c0489
--- a/sysdeps/powerpc/fpu/fenv_libc.h
7c0489
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
7c0489
@@ -98,6 +98,14 @@ __fesetround_inline (int round)
7c0489
   return 0;
7c0489
 }
7c0489
 
7c0489
+/* Same as __fesetround_inline, however without runtime check to use DFP
7c0489
+   mtfsfi syntax (as relax_fenv_state) or if round value is valid.  */
7c0489
+static inline void
7c0489
+__fesetround_inline_nocheck (const int round)
7c0489
+{
7c0489
+  asm volatile ("mtfsfi 7,%0" : : "i" (round));
7c0489
+}
7c0489
+
7c0489
 /* Definitions of all the FPSCR bit numbers */
7c0489
 enum {
7c0489
   FPSCR_FX = 0,    /* exception summary */
7c0489
diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
7c0489
new file mode 100644
7c0489
index 0000000000000000..c70afbb10f600d81
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
7c0489
@@ -0,0 +1,105 @@
7c0489
+/* Round to integer generic implementation.
7c0489
+   Copyright (C) 2019 Free Software Foundation, Inc.
7c0489
+   This file is part of the GNU C Library
7c0489
+
7c0489
+   The GNU C Library is free software; you can redistribute it and/or
7c0489
+   modify it under the terms of the GNU Library General Public License as
7c0489
+   published by the Free Software Foundation; either version 2 of the
7c0489
+   License, or (at your option) any later version.
7c0489
+
7c0489
+   The GNU C Library is distributed in the hope that it will be useful,
7c0489
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
+   Library General Public License for more details.
7c0489
+
7c0489
+   You should have received a copy of the GNU Library General Public
7c0489
+   License along with the GNU C Library; see the file COPYING.LIB.  If
7c0489
+   not, see <http://www.gnu.org/licenses/>.  */
7c0489
+
7c0489
+#ifndef _ROUND_TO_INTEGER_H
7c0489
+#define _ROUND_TO_INTEGER_H
7c0489
+
7c0489
+#include <fenv_private.h>
7c0489
+
7c0489
+enum round_mode
7c0489
+{
7c0489
+  CEIL
7c0489
+};
7c0489
+
7c0489
+static inline void
7c0489
+set_fenv_mode (enum round_mode mode)
7c0489
+{
7c0489
+  int rmode;
7c0489
+  switch (mode)
7c0489
+  {
7c0489
+  case CEIL:  rmode = FE_UPWARD; break;
7c0489
+  default:    rmode = FE_TONEAREST; break;
7c0489
+  }
7c0489
+  __fesetround_inline_nocheck (rmode);
7c0489
+}
7c0489
+
7c0489
+static inline float
7c0489
+round_to_integer_float (enum round_mode mode, float x)
7c0489
+{
7c0489
+  /* Ensure sNaN input is converted to qNaN.  */
7c0489
+  if (__glibc_unlikely (isnan (x)))
7c0489
+    return x + x;
7c0489
+
7c0489
+  if (fabs (x) > 0x1p+23)
7c0489
+    return x;
7c0489
+
7c0489
+  float r = x;
7c0489
+
7c0489
+  /* Save current FPU rounding mode and inexact state.  */
7c0489
+  fenv_t fe = fegetenv_register ();
7c0489
+  set_fenv_mode (mode);
7c0489
+  if (x > 0.0)
7c0489
+    {
7c0489
+      r += 0x1p+23;
7c0489
+      r -= 0x1p+23;
7c0489
+      r = fabs (r);
7c0489
+    }
7c0489
+  else if (x < 0.0)
7c0489
+    {
7c0489
+      r -= 0x1p+23;
7c0489
+      r += 0x1p+23;
7c0489
+      r = -fabs (r);
7c0489
+    }
7c0489
+  __builtin_mtfsf (0xff, fe);
7c0489
+
7c0489
+  return r;
7c0489
+}
7c0489
+
7c0489
+static inline double
7c0489
+round_to_integer_double (enum round_mode mode, double x)
7c0489
+{
7c0489
+  /* Ensure sNaN input is converted to qNaN.  */
7c0489
+  if (__glibc_unlikely (isnan (x)))
7c0489
+    return x + x;
7c0489
+
7c0489
+  if (fabs (x) > 0x1p+52)
7c0489
+    return x;
7c0489
+
7c0489
+  double r = x;
7c0489
+
7c0489
+  /* Save current FPU rounding mode and inexact state.  */
7c0489
+  fenv_t fe = fegetenv_register ();
7c0489
+  set_fenv_mode (mode);
7c0489
+  if (x > 0.0)
7c0489
+    {
7c0489
+      r += 0x1p+52;
7c0489
+      r -= 0x1p+52;
7c0489
+      r = fabs (r);
7c0489
+    }
7c0489
+  else if (x < 0.0)
7c0489
+    {
7c0489
+      r -= 0x1p+52;
7c0489
+      r += 0x1p+52;
7c0489
+      r = -fabs (r);
7c0489
+    }
7c0489
+  __builtin_mtfsf (0xff, fe);
7c0489
+
7c0489
+  return r;
7c0489
+}
7c0489
+
7c0489
+#endif
7c0489
diff --git a/sysdeps/powerpc/fpu/s_ceil.c b/sysdeps/powerpc/fpu/s_ceil.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..49008c7af87d6d55
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/fpu/s_ceil.c
7c0489
@@ -0,0 +1,35 @@
7c0489
+/* Smallest integral value not less than argument.  PowerPC version.
7c0489
+   Copyright (C) 2019 Free Software Foundation, Inc.
7c0489
+   This file is part of the GNU C Library
7c0489
+
7c0489
+   The GNU C Library is free software; you can redistribute it and/or
7c0489
+   modify it under the terms of the GNU Library General Public License as
7c0489
+   published by the Free Software Foundation; either version 2 of the
7c0489
+   License, or (at your option) any later version.
7c0489
+
7c0489
+   The GNU C Library is distributed in the hope that it will be useful,
7c0489
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
+   Library General Public License for more details.
7c0489
+
7c0489
+   You should have received a copy of the GNU Library General Public
7c0489
+   License along with the GNU C Library; see the file COPYING.LIB.  If
7c0489
+   not, see <http://www.gnu.org/licenses/>.  */
7c0489
+
7c0489
+#define NO_MATH_REDIRECT
7c0489
+#include <math.h>
7c0489
+#include <libm-alias-double.h>
7c0489
+#include <round_to_integer.h>
7c0489
+
7c0489
+double
7c0489
+__ceil (double x)
7c0489
+{
7c0489
+#ifdef _ARCH_PWR5X
7c0489
+  return __builtin_ceil (x);
7c0489
+#else
7c0489
+  return round_to_integer_double (CEIL, x);
7c0489
+#endif
7c0489
+}
7c0489
+#ifndef __ceil
7c0489
+libm_alias_double (__ceil, ceil)
7c0489
+#endif
7c0489
diff --git a/sysdeps/powerpc/fpu/s_ceilf.c b/sysdeps/powerpc/fpu/s_ceilf.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..8c86bf30a34df4cf
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/fpu/s_ceilf.c
7c0489
@@ -0,0 +1,35 @@
7c0489
+/* Smallest integral value not less than argument.  PowerPC version.
7c0489
+   Copyright (C) 2019 Free Software Foundation, Inc.
7c0489
+   This file is part of the GNU C Library
7c0489
+
7c0489
+   The GNU C Library is free software; you can redistribute it and/or
7c0489
+   modify it under the terms of the GNU Library General Public License as
7c0489
+   published by the Free Software Foundation; either version 2 of the
7c0489
+   License, or (at your option) any later version.
7c0489
+
7c0489
+   The GNU C Library is distributed in the hope that it will be useful,
7c0489
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
+   Library General Public License for more details.
7c0489
+
7c0489
+   You should have received a copy of the GNU Library General Public
7c0489
+   License along with the GNU C Library; see the file COPYING.LIB.  If
7c0489
+   not, see <http://www.gnu.org/licenses/>.  */
7c0489
+
7c0489
+#define NO_MATH_REDIRECT
7c0489
+#include <math.h>
7c0489
+#include <libm-alias-float.h>
7c0489
+#include <round_to_integer.h>
7c0489
+
7c0489
+float
7c0489
+__ceilf (float x)
7c0489
+{
7c0489
+#ifdef _ARCH_PWR5X
7c0489
+  return __builtin_ceilf (x);
7c0489
+#else
7c0489
+  return round_to_integer_float (CEIL, x);
7c0489
+#endif
7c0489
+}
7c0489
+#ifndef __ceilf
7c0489
+libm_alias_float (__ceil, ceil)
7c0489
+#endif
7c0489
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
7c0489
deleted file mode 100644
7c0489
index 7f2f97ada1a14a52..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
7c0489
+++ /dev/null
7c0489
@@ -1,76 +0,0 @@
7c0489
-/* ceil function.  PowerPC32 version.
7c0489
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <libm-alias-double.h>
7c0489
-
7c0489
-	.section	.rodata.cst4,"aM",@progbits,4
7c0489
-	.align	2
7c0489
-.LC0:	/* 2**52 */
7c0489
-	.long 0x59800000
7c0489
-
7c0489
-	.section	".text"
7c0489
-ENTRY (__ceil)
7c0489
-#ifdef SHARED
7c0489
-	mflr	r11
7c0489
-	cfi_register(lr,r11)
7c0489
-	SETUP_GOT_ACCESS(r9,got_label)
7c0489
-	addis	r9,r9,.LC0-got_label@ha
7c0489
-	lfs	fp13,.LC0-got_label@l(r9)
7c0489
-	mtlr	r11
7c0489
-	cfi_same_value (lr)
7c0489
-#else
7c0489
-	lis	r9,.LC0@ha
7c0489
-	lfs	fp13,.LC0@l(r9)
7c0489
-#endif
7c0489
-	fabs	fp0,fp1
7c0489
-	fsub	fp12,fp13,fp13	/* generate 0.0  */
7c0489
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
7c0489
-	mffs	fp11		/* Save current FPU rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
7c0489
-	bnl-	cr7,.L10
7c0489
-	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
7c0489
-	ble-	cr6,.L4
7c0489
-	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
7c0489
-	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
7c0489
-	fabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = 0.0; */
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L4:
7c0489
-	bge-	cr6,.L9		/* if (x < 0.0)  */
7c0489
-	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
7c0489
-	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
7c0489
-	fnabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = -0.0; */
7c0489
-.L9:
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L10:
7c0489
-	/* Ensure sNaN input is converted to qNaN.  */
7c0489
-	fcmpu	cr7,fp1,fp1
7c0489
-	beqlr	cr7
7c0489
-	fadd	fp1,fp1,fp1
7c0489
-	blr
7c0489
-	END (__ceil)
7c0489
-
7c0489
-libm_alias_double (__ceil, ceil)
7c0489
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
7c0489
deleted file mode 100644
7c0489
index 3f5949004fa51baf..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
7c0489
+++ /dev/null
7c0489
@@ -1,76 +0,0 @@
7c0489
-/* float ceil function.  PowerPC32 version.
7c0489
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <libm-alias-float.h>
7c0489
-
7c0489
-	.section	.rodata.cst4,"aM",@progbits,4
7c0489
-	.align	2
7c0489
-.LC0:	/* 2**23 */
7c0489
-	.long 0x4b000000
7c0489
-
7c0489
-	.section	".text"
7c0489
-ENTRY (__ceilf)
7c0489
-#ifdef SHARED
7c0489
-	mflr	r11
7c0489
-	cfi_register(lr,r11)
7c0489
-	SETUP_GOT_ACCESS(r9,got_label)
7c0489
-	addis	r9,r9,.LC0-got_label@ha
7c0489
-	lfs	fp13,.LC0-got_label@l(r9)
7c0489
-	mtlr	r11
7c0489
-	cfi_same_value (lr)
7c0489
-#else
7c0489
-	lis	r9,.LC0@ha
7c0489
-	lfs	fp13,.LC0@l(r9)
7c0489
-#endif
7c0489
-	fabs	fp0,fp1
7c0489
-	fsubs	fp12,fp13,fp13	/* generate 0.0  */
7c0489
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
7c0489
-	mffs	fp11		/* Save current FPU rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
7c0489
-	bnl-	cr7,.L10
7c0489
-	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
7c0489
-	ble-	cr6,.L4
7c0489
-	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
7c0489
-	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
7c0489
-	fabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = 0.0; */
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L4:
7c0489
-	bge-	cr6,.L9		/* if (x < 0.0)  */
7c0489
-	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
7c0489
-	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
7c0489
-	fnabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = -0.0; */
7c0489
-.L9:
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L10:
7c0489
-	/* Ensure sNaN input is converted to qNaN.  */
7c0489
-	fcmpu	cr7,fp1,fp1
7c0489
-	beqlr	cr7
7c0489
-	fadds	fp1,fp1,fp1
7c0489
-	blr
7c0489
-	END (__ceilf)
7c0489
-
7c0489
-libm_alias_float (__ceil, ceil)
7c0489
-
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
7c0489
index 4e85021d50831eb6..cf38e347f2da74e9 100644
7c0489
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
7c0489
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
7c0489
@@ -26,6 +26,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
7c0489
 			s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \
7c0489
 			e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32
7c0489
 
7c0489
+CFLAGS-s_ceil-power5+.c = -mcpu=power5+
7c0489
+CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
7c0489
 CFLAGS-s_modf-power5+.c = -mcpu=power5+
7c0489
 CFLAGS-s_modff-power5+.c = -mcpu=power5+
7c0489
 CFLAGS-s_logbl-power7.c = -mcpu=power7
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
7c0489
deleted file mode 100644
7c0489
index b8181585a869bd8a..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
7c0489
+++ /dev/null
7c0489
@@ -1,33 +0,0 @@
7c0489
-/* ceil function.  PowerPC32/power5+ version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-
7c0489
-#undef hidden_def
7c0489
-#define hidden_def(name)
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(name, alias)
7c0489
-#undef strong_alias
7c0489
-#define strong_alias(name, alias)
7c0489
-#undef compat_symbol
7c0489
-#define compat_symbol(lib, name, alias, ver)
7c0489
-
7c0489
-#define __ceil __ceil_power5plus
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..87bc66cdb0322c59
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceil __ceil_power5plus
7c0489
+#include <sysdeps/powerpc/fpu/s_ceil.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
7c0489
deleted file mode 100644
7c0489
index cd2bc69b677e76db..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
7c0489
+++ /dev/null
7c0489
@@ -1,31 +0,0 @@
7c0489
-/* ceil function.  PowerPC32 default version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-#undef strong_alias
7c0489
-#define strong_alias(a,b)
7c0489
-#undef compat_symbol
7c0489
-#define compat_symbol(a,b,c,d)
7c0489
-
7c0489
-#define __ceil __ceil_ppc32
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc32/fpu/s_ceil.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..93c098476b915f9d
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceil __ceil_ppc32
7c0489
+#include <sysdeps/powerpc/fpu/s_ceil.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
7c0489
deleted file mode 100644
7c0489
index d01aa6e7db3d0b9d..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
7c0489
+++ /dev/null
7c0489
@@ -1,26 +0,0 @@
7c0489
-/* ceilf function.  PowerPC32/power5+ version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(name, alias)
7c0489
-
7c0489
-#define __ceilf __ceilf_power5plus
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..a5bfa98535c088a0
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceilf __ceilf_power5plus
7c0489
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
7c0489
deleted file mode 100644
7c0489
index 264e032b3b27f9b3..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
7c0489
+++ /dev/null
7c0489
@@ -1,27 +0,0 @@
7c0489
-/* ceilf function.  PowerPC32 default version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-
7c0489
-#define __ceilf __ceilf_ppc32
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc32/fpu/s_ceilf.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..a4dcdcb4069289d6
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceilf __ceilf_ppc32
7c0489
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
7c0489
deleted file mode 100644
7c0489
index 356c7a79edf79940..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
7c0489
+++ /dev/null
7c0489
@@ -1,29 +0,0 @@
7c0489
-/* ceil function.  PowerPC32/power5+ version.
7c0489
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <libm-alias-double.h>
7c0489
-
7c0489
-	.machine	"power5"
7c0489
-EALIGN (__ceil, 4, 0)
7c0489
-	frip	fp1, fp1
7c0489
-	blr
7c0489
-	END (__ceil)
7c0489
-
7c0489
-libm_alias_double (__ceil, ceil)
7c0489
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
7c0489
deleted file mode 100644
7c0489
index a0bcda17fde0c0f6..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
7c0489
+++ /dev/null
7c0489
@@ -1,30 +0,0 @@
7c0489
-/* ceilf function.  PowerPC32/power5+ version.
7c0489
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <libm-alias-float.h>
7c0489
-
7c0489
-	.machine	"power5"
7c0489
-EALIGN (__ceilf, 4, 0)
7c0489
-	frip	fp1, fp1	/* The rounding instructions are double.  */
7c0489
-	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
7c0489
-	blr
7c0489
-	END (__ceilf)
7c0489
-
7c0489
-libm_alias_float (__ceil, ceil)
7c0489
-
7c0489
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
7c0489
new file mode 100644
7c0489
index 0000000000000000..932c3c7e6c6ad27e
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
7c0489
@@ -0,0 +1,9 @@
7c0489
+ifeq ($(subdir),math)
7c0489
+libm-sysdep_routines += s_ceil-power5+ \
7c0489
+			s_ceil-ppc64 \
7c0489
+			s_ceilf-power5+ \
7c0489
+			s_ceilf-ppc64
7c0489
+
7c0489
+CFLAGS-s_ceil-power5+.c = -mcpu=power5+
7c0489
+CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
7c0489
+endif
7c0489
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..87bc66cdb0322c59
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceil __ceil_power5plus
7c0489
+#include <sysdeps/powerpc/fpu/s_ceil.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..8711ff3229467026
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceil __ceil_ppc64
7c0489
+#include <sysdeps/powerpc/fpu/s_ceil.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
7c0489
similarity index 95%
7c0489
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c
7c0489
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
7c0489
index 5cde4eb46f26ec82..1abca7ef63d6a852 100644
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
7c0489
@@ -17,10 +17,8 @@
7c0489
    <http://www.gnu.org/licenses/>.  */
7c0489
 
7c0489
 #include <math.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <shlib-compat.h>
7c0489
-#include "init-arch.h"
7c0489
 #include <libm-alias-double.h>
7c0489
+#include "init-arch.h"
7c0489
 
7c0489
 extern __typeof (__ceil) __ceil_ppc64 attribute_hidden;
7c0489
 extern __typeof (__ceil) __ceil_power5plus attribute_hidden;
7c0489
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..a5bfa98535c088a0
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceilf __ceilf_power5plus
7c0489
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
7c0489
new file mode 100644
7c0489
index 0000000000000000..086251dc0937acfa
7c0489
--- /dev/null
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
7c0489
@@ -0,0 +1,3 @@
7c0489
+#include <math.h>
7c0489
+#define __ceilf __ceilf_ppc64
7c0489
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
7c0489
similarity index 95%
7c0489
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c
7c0489
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
7c0489
index 18697e52b3ac1616..33245968a86ddcf5 100644
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c
7c0489
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
7c0489
@@ -17,10 +17,8 @@
7c0489
    <http://www.gnu.org/licenses/>.  */
7c0489
 
7c0489
 #include <math.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <shlib-compat.h>
7c0489
-#include "init-arch.h"
7c0489
 #include <libm-alias-float.h>
7c0489
+#include "init-arch.h"
7c0489
 
7c0489
 extern __typeof (__ceilf) __ceilf_ppc64 attribute_hidden;
7c0489
 extern __typeof (__ceilf) __ceilf_power5plus attribute_hidden;
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
7c0489
index 73f2f693771027a9..2805e4e0d66f3175 100644
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
7c0489
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
7c0489
@@ -14,8 +14,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
7c0489
 
7c0489
 sysdep_routines += $(sysdep_calls)
7c0489
 libm-sysdep_routines += s_llround-power6x \
7c0489
-			s_llround-power5+ s_llround-ppc64 s_ceil-power5+ \
7c0489
-			s_ceil-ppc64 s_ceilf-power5+ s_ceilf-ppc64 \
7c0489
+			s_llround-power5+ s_llround-ppc64 \
7c0489
 			s_floor-power5+ s_floor-ppc64 s_floorf-power5+ \
7c0489
 			s_floorf-ppc64 s_round-power5+ s_round-ppc64 \
7c0489
 			s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
7c0489
deleted file mode 100644
7c0489
index 76651b694c251bb4..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
7c0489
+++ /dev/null
7c0489
@@ -1,30 +0,0 @@
7c0489
-/* ceil function.  PowerPC64/power5+ version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <shlib-compat.h>
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-#undef strong_alias
7c0489
-#define strong_alias(a,b)
7c0489
-#undef compat_symbol
7c0489
-#define compat_symbol(a,b,c,d)
7c0489
-
7c0489
-#define __ceil __ceil_power5plus
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
7c0489
deleted file mode 100644
7c0489
index c75c66ba3bbf49c8..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
7c0489
+++ /dev/null
7c0489
@@ -1,30 +0,0 @@
7c0489
-/* ceil function.  PowerPC64 default version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <shlib-compat.h>
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-#undef strong_alias
7c0489
-#define strong_alias(a,b)
7c0489
-#undef compat_symbol
7c0489
-#define compat_symbol(a,b,c,d)
7c0489
-
7c0489
-#define __ceil __ceil_ppc64
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc64/fpu/s_ceil.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
7c0489
deleted file mode 100644
7c0489
index b9c9e14fba6ee134..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
7c0489
+++ /dev/null
7c0489
@@ -1,24 +0,0 @@
7c0489
-/* ceilf function.  PowerPC64/power5+ version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-
7c0489
-#define __ceilf __ceilf_power5plus
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
7c0489
deleted file mode 100644
7c0489
index ce5cc49770fdfdee..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
7c0489
+++ /dev/null
7c0489
@@ -1,24 +0,0 @@
7c0489
-/* ceilf function.  PowerPC64 default version.
7c0489
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#undef weak_alias
7c0489
-#define weak_alias(a,b)
7c0489
-
7c0489
-#define __ceilf __ceilf_ppc64
7c0489
-
7c0489
-#include <sysdeps/powerpc/powerpc64/fpu/s_ceilf.S>
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
7c0489
deleted file mode 100644
7c0489
index 252d94f51ea1a167..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
7c0489
+++ /dev/null
7c0489
@@ -1,65 +0,0 @@
7c0489
-/* ceil function.  PowerPC64 version.
7c0489
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <libm-alias-double.h>
7c0489
-
7c0489
-	.section	".toc","aw"
7c0489
-.LC0:	/* 2**52 */
7c0489
-	.tc FD_43300000_0[TC],0x4330000000000000
7c0489
-	.section	".text"
7c0489
-
7c0489
-ENTRY (__ceil, 4)
7c0489
-	CALL_MCOUNT 0
7c0489
-	lfd	fp13,.LC0@toc(2)
7c0489
-	fabs	fp0,fp1
7c0489
-	fsub	fp12,fp13,fp13	/* generate 0.0  */
7c0489
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
7c0489
-	mffs	fp11		/* Save current FPU rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
7c0489
-	bnl-	cr7,.L10
7c0489
-	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
7c0489
-	ble-	cr6,.L4
7c0489
-	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
7c0489
-	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
7c0489
-	fabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = 0.0; */
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L4:
7c0489
-	bge-	cr6,.L9		/* if (x < 0.0)  */
7c0489
-	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
7c0489
-	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
7c0489
-	fnabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = -0.0; */
7c0489
-.L9:
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L10:
7c0489
-	/* Ensure sNaN input is converted to qNaN.  */
7c0489
-	fcmpu	cr7,fp1,fp1
7c0489
-	beqlr	cr7
7c0489
-	fadd	fp1,fp1,fp1
7c0489
-	blr
7c0489
-	END (__ceil)
7c0489
-
7c0489
-libm_alias_double (__ceil, ceil)
7c0489
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
7c0489
deleted file mode 100644
7c0489
index 3c62077c143eeced..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
7c0489
+++ /dev/null
7c0489
@@ -1,67 +0,0 @@
7c0489
-/* float ceil function.  PowerPC64 version.
7c0489
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <libm-alias-float.h>
7c0489
-
7c0489
-	.section	".toc","aw"
7c0489
-	.p2align 3
7c0489
-.LC0:	/* 2**23 */
7c0489
-	.long 0x4b000000
7c0489
-	.long 0x0
7c0489
-	.section	".text"
7c0489
-
7c0489
-ENTRY (__ceilf, 4)
7c0489
-	CALL_MCOUNT 0
7c0489
-	lfs	fp13,.LC0@toc(2)
7c0489
-	fabs	fp0,fp1
7c0489
-	fsubs	fp12,fp13,fp13	/* generate 0.0  */
7c0489
-	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
7c0489
-	mffs	fp11		/* Save current FPU rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
7c0489
-	bnl-	cr7,.L10
7c0489
-	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
7c0489
-	ble-	cr6,.L4
7c0489
-	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
7c0489
-	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
7c0489
-	fabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = 0.0; */
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L4:
7c0489
-	bge-	cr6,.L9		/* if (x < 0.0)  */
7c0489
-	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
7c0489
-	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
7c0489
-	fnabs	fp1,fp1		/* if (x == 0.0)  */
7c0489
-				/* x = -0.0; */
7c0489
-.L9:
7c0489
-	mtfsf	0xff,fp11	/* Restore previous rounding mode and
7c0489
-				   "inexact" state.  */
7c0489
-	blr
7c0489
-.L10:
7c0489
-	/* Ensure sNaN input is converted to qNaN.  */
7c0489
-	fcmpu	cr7,fp1,fp1
7c0489
-	beqlr	cr7
7c0489
-	fadds	fp1,fp1,fp1
7c0489
-	blr
7c0489
-	END (__ceilf)
7c0489
-
7c0489
-libm_alias_float (__ceil, ceil)
7c0489
-
7c0489
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
7c0489
deleted file mode 100644
7c0489
index e500932573c07503..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
7c0489
+++ /dev/null
7c0489
@@ -1,30 +0,0 @@
7c0489
-/* ceil function.  PowerPC64/power5+ version.
7c0489
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <math_ldbl_opt.h>
7c0489
-#include <libm-alias-double.h>
7c0489
-
7c0489
-	.machine	"power5"
7c0489
-ENTRY_TOCLESS (__ceil, 4)
7c0489
-	CALL_MCOUNT 0
7c0489
-	frip	fp1, fp1
7c0489
-	blr
7c0489
-	END (__ceil)
7c0489
-
7c0489
-libm_alias_double (__ceil, ceil)
7c0489
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
7c0489
deleted file mode 100644
7c0489
index d0b2118c2a3f81be..0000000000000000
7c0489
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
7c0489
+++ /dev/null
7c0489
@@ -1,31 +0,0 @@
7c0489
-/* ceilf function.  PowerPC64/power5+ version.
7c0489
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
7c0489
-   This file is part of the GNU C Library.
7c0489
-
7c0489
-   The GNU C Library is free software; you can redistribute it and/or
7c0489
-   modify it under the terms of the GNU Lesser General Public
7c0489
-   License as published by the Free Software Foundation; either
7c0489
-   version 2.1 of the License, or (at your option) any later version.
7c0489
-
7c0489
-   The GNU C Library is distributed in the hope that it will be useful,
7c0489
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
7c0489
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c0489
-   Lesser General Public License for more details.
7c0489
-
7c0489
-   You should have received a copy of the GNU Lesser General Public
7c0489
-   License along with the GNU C Library; if not, see
7c0489
-   <http://www.gnu.org/licenses/>.  */
7c0489
-
7c0489
-#include <sysdep.h>
7c0489
-#include <libm-alias-float.h>
7c0489
-
7c0489
-	.machine	"power5"
7c0489
-ENTRY_TOCLESS (__ceilf, 4)
7c0489
-	CALL_MCOUNT 0
7c0489
-	frip	fp1, fp1	/* The rounding instructions are double.  */
7c0489
-	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
7c0489
-	blr
7c0489
-	END (__ceilf)
7c0489
-
7c0489
-libm_alias_float (__ceil, ceil)
7c0489
-