aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-03-08 15:20:08 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-05-09 09:39:07 -0300
commita1cb1888b7aaa65cfa6d4e067c7516e2e08d8942 (patch)
treed9df8b4705fe0aa6e74b224efbdf55ed3edd0c03
parent252296c625a7ab59633a3837954d426f0ce89d3b (diff)
downloadglibc-a1cb1888b7aaa65cfa6d4e067c7516e2e08d8942.tar
glibc-a1cb1888b7aaa65cfa6d4e067c7516e2e08d8942.tar.gz
glibc-a1cb1888b7aaa65cfa6d4e067c7516e2e08d8942.tar.bz2
glibc-a1cb1888b7aaa65cfa6d4e067c7516e2e08d8942.zip
powerpc: round/roundf refactor
This patches consolidates all the powerpc round{f} implementations on the generic sysdeps/powerpc/fpu/s_round{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frim instruction) or a generic implementation which uses FP only operations. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le (since minium ISA of 2.08 does not require the fallback generic implementation). Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add ROUND handling. (round_mode): Add definition for ROUND. (round_to_integer_float): Likewise. * sysdeps/powerpc/fpu/s_round.c: New file. * sysdeps/powerpc/fpu/s_roundf.c: New file. * sysdeps/powerpc/powerpc32/fpu/s_round.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.c: New file. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.c: Likewise. * sysdep/powerpc/powerpc32/power5+/fpu/s_round.S: Remove file. * sysdep/powerpc/powerpc32/power5+/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_round-power5+, s_round-ppc64, s_roundf-power5+, and s_roundf-ppc64. (CFLAGS-s_round-power5+.c, CFLAGS-s_roundf-power5+.c): New rule. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c: ... here. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_round-power5+, s_round-ppc64, s_roundf-power5+, and s_roundf-ppc64. * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S: Remove file. * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise. Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
-rw-r--r--ChangeLog55
-rw-r--r--sysdeps/powerpc/fpu/round_to_integer.h20
-rw-r--r--sysdeps/powerpc/fpu/s_round.c35
-rw-r--r--sysdeps/powerpc/fpu/s_roundf.c35
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_round.S97
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_roundf.S96
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S33
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S31
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S26
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S27
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S29
-rw-r--r--sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S30
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile8
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c (renamed from sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c)0
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c (renamed from sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c)0
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile3
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S30
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S30
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S24
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S24
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_round.S80
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_roundf.S82
-rw-r--r--sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S30
-rw-r--r--sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S31
32 files changed, 176 insertions, 704 deletions
diff --git a/ChangeLog b/ChangeLog
index ca2af4394a..e4221474de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,60 @@
2019-05-09 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add
+ ROUND handling.
+ (round_mode): Add definition for ROUND.
+ (round_to_integer_float): Likewise.
+ * sysdeps/powerpc/fpu/s_round.c: New file.
+ * sysdeps/powerpc/fpu/s_roundf.c: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_round.S: Remove file.
+ * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.S:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.S:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.S:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.S:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.c: New
+ file.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.c:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.c:
+ Likewise.
+ * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.c:
+ Likewise.
+ * sysdep/powerpc/powerpc32/power5+/fpu/s_round.S: Remove file.
+ * sysdep/powerpc/powerpc32/power5+/fpu/s_roundf.S: Likewise.
+ * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile
+ (libm-sysdep_routines): Add s_round-power5+, s_round-ppc64,
+ s_roundf-power5+, and s_roundf-ppc64.
+ (CFLAGS-s_round-power5+.c, CFLAGS-s_roundf-power5+.c): New rule.
+ * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-power5+.c: New
+ file.
+ * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-ppc64.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Move to ...
+ * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c: ... here.
+ * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-power5+.c: New
+ file.
+ * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-ppc64.c:
+ Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Move to ...
+ * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c: ... here.
+ * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+ (libm-sysdep_routines): Remove s_round-power5+, s_round-ppc64,
+ s_roundf-power5+, and s_roundf-ppc64.
+ * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S: Remove
+ file.
+ * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S: Likewise.
+ * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S:
+ Likewise.
+ * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
+ * sysdep/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
+ * sysdep/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
+
* sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode):
Add FLOOR option.
(round_mode): Add definition for FLOOR.
diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index ff77dde394..b318e37190 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -24,7 +24,8 @@
enum round_mode
{
CEIL,
- FLOOR
+ FLOOR,
+ ROUND
};
static inline void
@@ -35,6 +36,7 @@ set_fenv_mode (enum round_mode mode)
{
case CEIL: rmode = FE_UPWARD; break;
case FLOOR: rmode = FE_DOWNWARD; break;
+ case ROUND: rmode = FE_TOWARDZERO; break;
default: rmode = FE_TONEAREST; break;
}
__fesetround_inline_nocheck (rmode);
@@ -57,12 +59,24 @@ round_to_integer_float (enum round_mode mode, float x)
set_fenv_mode (mode);
if (x > 0.0)
{
+ /* IEEE 1003.1 round function. IEEE specifies "round to the nearest
+ integer value, rounding halfway cases away from zero, regardless of
+ the current rounding mode." However PowerPC Architecture defines
+ "Round to Nearest" as "Choose the best approximation. In case of a
+ tie, choose the one that is even (least significant bit o).".
+ So we can't use the PowerPC "Round to Nearest" mode. Instead we set
+ "Round toward Zero" mode and round by adding +-0.5 before rounding
+ to the integer value. */
+ if (mode == ROUND)
+ r += 0.5f;
r += 0x1p+23;
r -= 0x1p+23;
r = fabs (r);
}
else if (x < 0.0)
{
+ if (mode == ROUND)
+ r -= 0.5f;
r -= 0x1p+23;
r += 0x1p+23;
r = -fabs (r);
@@ -89,12 +103,16 @@ round_to_integer_double (enum round_mode mode, double x)
set_fenv_mode (mode);
if (x > 0.0)
{
+ if (mode == ROUND)
+ r += 0.5;
r += 0x1p+52;
r -= 0x1p+52;
r = fabs (r);
}
else if (x < 0.0)
{
+ if (mode == ROUND)
+ r -= 0.5;
r -= 0x1p+52;
r += 0x1p+52;
r = -fabs (r);
diff --git a/sysdeps/powerpc/fpu/s_round.c b/sysdeps/powerpc/fpu/s_round.c
new file mode 100644
index 0000000000..cd105567ef
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_round.c
@@ -0,0 +1,35 @@
+/* Largest integral value not greater than argument. PowerPC version.
+ Copyright (C) 2019 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__round (double x)
+{
+#ifdef _ARCH_PWR5X
+ return __builtin_round (x);
+#else
+ return round_to_integer_double (ROUND, x);
+#endif
+}
+#ifndef __round
+libm_alias_double (__round, round)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_roundf.c b/sysdeps/powerpc/fpu/s_roundf.c
new file mode 100644
index 0000000000..418062adba
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_roundf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument. PowerPC version.
+ Copyright (C) 2019 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__roundf (float x)
+{
+#ifdef _ARCH_PWR5X
+ return __builtin_roundf (x);
+#else
+ return round_to_integer_float (ROUND, x);
+#endif
+}
+#ifndef __roundf
+libm_alias_float (__round, round)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
deleted file mode 100644
index 26c7516458..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/* round function. PowerPC32 version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst8,"aM",@progbits,8
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
-/* double [fp1] round (double x [fp1])
- IEEE 1003.1 round function. IEEE specifies "round to the nearest
- integer value, rounding halfway cases away from zero, regardless of
- the current rounding mode." However PowerPC Architecture defines
- "Round to Nearest" as "Choose the best approximation. In case of a
- tie, choose the one that is even (least significant bit o).".
- So we can't use the PowerPC "Round to Nearest" mode. Instead we set
- "Round toward Zero" mode and round by adding +-0.5 before rounding
- to the integer value. */
-
- .section ".text"
-ENTRY (__round)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- addi r9,r9,.LC0-got_label@l
- mtlr r11
- cfi_same_value (lr)
- lfs fp13,0(r9)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0. */
-#ifdef SHARED
- lfs fp10,.LC1-.LC0(r9)
-#else
- lis r9,.LC1@ha
- lfs fp10,.LC1@l(r9)
-#endif
- ble- cr6,.L4
- fadd fp1,fp1,fp10 /* x+= 0.5; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- fsub fp9,fp1,fp10 /* x+= 0.5; */
- bge- cr6,.L9 /* if (x < 0.0) */
- fsub fp1,fp9,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
deleted file mode 100644
index cb59a2ba51..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ /dev/null
@@ -1,96 +0,0 @@
-/* roundf function. PowerPC32 version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst8,"aM",@progbits,8
- .align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
-/* float [fp1] roundf (float x [fp1])
- IEEE 1003.1 round function. IEEE specifies "round to the nearest
- integer value, rounding halfway cases away from zero, regardless of
- the current rounding mode." However PowerPC Architecture defines
- "Round to Nearest" as "Choose the best approximation. In case of a
- tie, choose the one that is even (least significant bit o).".
- So we can't use the PowerPC "Round to Nearest" mode. Instead we set
- "Round toward Zero" mode and round by adding +-0.5 before rounding
- to the integer value. */
-
- .section ".text"
-ENTRY (__roundf )
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- addi r9,r9,.LC0-got_label@l
- mtlr r11
- cfi_same_value (lr)
- lfs fp13,0(r9)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0. */
-#ifdef SHARED
- lfs fp10,.LC1-.LC0(r9)
-#else
- lfs fp10,.LC1@l(r9)
-#endif
- ble- cr6,.L4
- fadds fp1,fp1,fp10 /* x+= 0.5; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- fsubs fp9,fp1,fp10 /* x+= 0.5; */
- bge- cr6,.L9 /* if (x < 0.0) */
- fsubs fp1,fp9,fp13 /* x-= TWO23; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
deleted file mode 100644
index eab96dbba7..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* round function. PowerPC32/power5+ version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __round __round_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
new file mode 100644
index 0000000000..3f6f87b4e2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_power5plus
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
deleted file mode 100644
index c2208c18fe..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* round function. PowerPC32 default version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
new file mode 100644
index 0000000000..92fbadf789
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_ppc32
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
deleted file mode 100644
index ce4d89c669..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* roundf function. PowerPC32/power5+ version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __roundf __roundf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
new file mode 100644
index 0000000000..b0cb5c5190
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_power5plus
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
deleted file mode 100644
index 30f4e3f7cd..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* roundf function. PowerPC32 default version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
new file mode 100644
index 0000000000..44023bbefd
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_ppc32
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
deleted file mode 100644
index 327d970b02..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* round function. PowerPC32/power5+ version.
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-EALIGN (__round, 4, 0)
- frin fp1, fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
deleted file mode 100644
index 59a21708f5..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* roundf function. PowerPC32/power5+ version.
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__roundf, 4, 0)
- frin fp1, fp1 /* The rounding instructions are double. */
- frsp fp1, fp1 /* But we need to set ooverflow for float. */
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 8bb06e5cc0..722f974cfb 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -6,10 +6,16 @@ libm-sysdep_routines += s_ceil-power5+ \
s_floor-power5+ \
s_floor-ppc64 \
s_floorf-power5+ \
- s_floorf-ppc64
+ s_floorf-ppc64 \
+ s_round-power5+ \
+ s_round-ppc64 \
+ s_roundf-power5+ \
+ s_roundf-ppc64
CFLAGS-s_ceil-power5+.c = -mcpu=power5+
CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
CFLAGS-s_floor-power5+.c = -mcpu=power5+
CFLAGS-s_floorf-power5+.c = -mcpu=power5+
+CFLAGS-s_round-power5+.c = -mcpu=power5+
+CFLAGS-s_roundf-power5+.c = -mcpu=power5+
endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
new file mode 100644
index 0000000000..3f6f87b4e2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_power5plus
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
new file mode 100644
index 0000000000..cb122e6afc
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_ppc64
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c
index eb66a8d528..eb66a8d528 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
new file mode 100644
index 0000000000..b0cb5c5190
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_power5plus
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
new file mode 100644
index 0000000000..3e1de69147
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_ppc64
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
index 640bca5a7a..640bca5a7a 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 8a73108e4c..11c39f4b35 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -15,8 +15,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
sysdep_routines += $(sysdep_calls)
libm-sysdep_routines += s_llround-power6x \
s_llround-power5+ s_llround-ppc64 \
- s_round-power5+ s_round-ppc64 \
- s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \
+ s_trunc-power5+ \
s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \
s_llrint-power6x s_llrint-ppc64 \
s_logb-power7 s_logbf-power7 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
deleted file mode 100644
index 8c38759d3f..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function. PowerPC64/power5+ version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
deleted file mode 100644
index 5ea616d429..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function. PowerPC64 default version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
deleted file mode 100644
index c29c31785e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* roundf function. PowerPC64/power5+ version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
deleted file mode 100644
index ced4241b2b..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* roundf function. PowerPC64 default version.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S
deleted file mode 100644
index 0b06a52d09..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_round.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* round function. PowerPC64 version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
-.LC1: /* 0.5 */
- .tc FD_3fe00000_0[TC],0x3fe0000000000000
- .section ".text"
-
-/* double [fp1] round (double x [fp1])
- IEEE 1003.1 round function. IEEE specifies "round to the nearest
- integer value, rounding halfway cases away from zero, regardless of
- the current rounding mode." However PowerPC Architecture defines
- "Round to Nearest" as "Choose the best approximation. In case of a
- tie, choose the one that is even (least significant bit o).".
- So we can't use the PowerPC "Round to Nearest" mode. Instead we set
- "Round toward Zero" mode and round by adding +-0.5 before rounding
- to the integer value. */
-
-ENTRY (__round, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0. */
- lfd fp10,.LC1@toc(2)
- ble- cr6,.L4
- fadd fp1,fp1,fp10 /* x+= 0.5; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- fsub fp9,fp1,fp10 /* x+= 0.5; */
- bge- cr6,.L9 /* if (x < 0.0) */
- fsub fp1,fp9,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
deleted file mode 100644
index a9c32c5774..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/* roundf function. PowerPC64 version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
- .section ".text"
-
-/* float [fp1] roundf (float x [fp1])
- IEEE 1003.1 round function. IEEE specifies "round to the nearest
- integer value, rounding halfway cases away from zero, regardless of
- the current rounding mode." However PowerPC Architecture defines
- "Round to Nearest" as "Choose the best approximation. In case of a
- tie, choose the one that is even (least significant bit o).".
- So we can't use the PowerPC "Round to Nearest" mode. Instead we set
- "Round toward Zero" mode and round by adding +-0.5 before rounding
- to the integer value. */
-
-ENTRY (__roundf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0. */
- lfs fp10,.LC1@toc(2)
- ble- cr6,.L4
- fadds fp1,fp1,fp10 /* x+= 0.5; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- fsubs fp9,fp1,fp10 /* x+= 0.5; */
- bge- cr6,.L9 /* if (x < 0.0) */
- fsubs fp1,fp9,fp13 /* x-= TWO23; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
deleted file mode 100644
index 45d010a919..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function. PowerPC64/power5+ version.
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__round, 4)
- CALL_MCOUNT 0
- frin fp1, fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
deleted file mode 100644
index 69fad1069f..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* roundf function. PowerPC64/power5+ version.
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__roundf, 4)
- CALL_MCOUNT 0
- frin fp1, fp1 /* The rounding instructions are double. */
- frsp fp1, fp1 /* But we need to set ooverflow for float. */
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-