aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/powerpc64/fpu
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-03-18 11:28:13 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-06-17 09:28:21 -0300
commitdee07df1a40533f1f2856111946eafbd45b81dbe (patch)
tree9febce88c8ce942f2ea7f259856caa2e58694a27 /sysdeps/powerpc/powerpc64/fpu
parent2166283fcc8ba3b4a4505acd2a91f2e7decf689c (diff)
downloadglibc-dee07df1a40533f1f2856111946eafbd45b81dbe.tar.xz
glibc-dee07df1a40533f1f2856111946eafbd45b81dbe.zip
powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf
This patches consolidates all the powerpc {l}lround{f} implementations on the generic sysdeps/powerpc/fpu/s_{l}lround{f}.c. The IFUNC support is also moved only to powerpc64 only, since for powerpc64le generic implementation resulting in optimized code. 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/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_llround-power8, s_llround-power6x, s_llround-power5+, s_llround-ppc64, and s_llroundf-ppc64. (CFLAGS-s_llround-power8.c, CFLAGS-s_llround-power6x.c, CFLAGS-s_llround-power5+.c): New rule. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lround.c: ... here. * sysdeps/powerpc/powerpc64/fpu/Makefile [$(subdir) == math] (CFLAGS-s_llround.c): New rule. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_llround-* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lround.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lroundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llround.c: New file. * sysdeps/powerpc/powerpc64/fpu/s_llroundf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lround.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lroundf.c: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S: Likewise. Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/powerpc64/fpu')
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/Makefile2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S31
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S31
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S30
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S27
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c48
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S31
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c47
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c1
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llround.S86
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llround.c83
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundf.S89
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundf.c83
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lround.S1
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lround.c1
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lroundf.S1
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_lroundf.c1
18 files changed, 171 insertions, 427 deletions
diff --git a/sysdeps/powerpc/powerpc64/fpu/Makefile b/sysdeps/powerpc/powerpc64/fpu/Makefile
index 6988a1d396..05075c2a75 100644
--- a/sysdeps/powerpc/powerpc64/fpu/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/Makefile
@@ -2,4 +2,6 @@ ifeq ($(subdir),math)
# lrintf and llrintf are aliased to llrint, so suppress compiler builtins to
# avoid mismatched signatures.
CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf
+# Same as before but for lroundf and llroundf
+CFLAGS-s_llround.c += -fno-builtin-lroundf -fno-builtin-llroundf
endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index fec878bb9d..48cf8dca3b 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -6,13 +6,10 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \
s_modff-power5+ s_modff-ppc64
sysdep_routines += $(sysdep_calls)
-libm-sysdep_routines += s_llround-power6x \
- s_llround-power5+ s_llround-ppc64 \
- s_logb-power7 s_logbf-power7 \
+libm-sysdep_routines += s_logb-power7 s_logbf-power7 \
s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
s_logbl-ppc64 e_hypot-ppc64 \
e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
- s_llround-power8 s_llroundf-ppc64 \
e_expf-power8 e_expf-ppc64 \
$(sysdep_calls:s_%=m_%)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S
deleted file mode 100644
index 59ec9d8dec..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* llround(). 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(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llround __llround_power5plus
-#define __lround __lround_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S
deleted file mode 100644
index 127c1e9959..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* llround(). 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(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __llround __llround_power6x
-#define __lround __lround_power6x
-
-#include <sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S
deleted file mode 100644
index 4e36482f0a..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* llround(). PowerPC64 default version.
- Copyright (C) 2014-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(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __llround __llround_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S
deleted file mode 100644
index fe01c33002..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* llround(). 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 compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llround __llround_ppc64
-#define __lround __lround_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_llround.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
deleted file mode 100644
index 173c0d38ad..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Multiple versions of llround.
- 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/>. */
-
-#define lround __hidden_lround
-#define __lround __hidden___lround
-
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-#include <libm-alias-double.h>
-
-extern __typeof (__llround) __llround_ppc64 attribute_hidden;
-extern __typeof (__llround) __llround_power5plus attribute_hidden;
-extern __typeof (__llround) __llround_power6x attribute_hidden;
-extern __typeof (__llround) __llround_power8 attribute_hidden;
-
-libc_ifunc (__llround,
- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
- ? __llround_power8 :
- (hwcap & PPC_FEATURE_POWER6_EXT)
- ? __llround_power6x :
- (hwcap & PPC_FEATURE_POWER5_PLUS)
- ? __llround_power5plus
- : __llround_ppc64);
-
-libm_alias_double (__llround, llround)
-
-/* long has the same width as long long on PPC64. */
-#undef lround
-#undef __lround
-strong_alias (__llround, __lround)
-libm_alias_double (__lround, lround)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S
deleted file mode 100644
index c62bb92e13..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* llroundf(). PowerPC64 default version.
- Copyright (C) 2017-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 __llroundf __llroundf_ppc64
-#define __lroundf __lroundf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_llroundf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c
deleted file mode 100644
index eba9f5ca3e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Multiple versions of llroundf.
- Copyright (C) 2017-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/>. */
-/* Redefine lroundf/__lroundf so that the compiler won't complain about
- the type mismatch with the IFUNC selector in strong_alias below. */
-#define lroundf __hidden_lroundf
-#define __lroundf __hidden___lroundf
-
-#include <math.h>
-#undef lroundf
-#undef __lroundf
-#include "init-arch.h"
-#include <libm-alias-float.h>
-
-extern __typeof (__llroundf) __llroundf_ppc64 attribute_hidden;
-extern __typeof (__llroundf) __llround_power6x attribute_hidden;
-extern __typeof (__llroundf) __llround_power8 attribute_hidden;
-
-/* The ppc64 ABI passes float and double parameters in 64bit floating point
- registers (at least up to a point) as IEEE binary64 format, so effectively
- of "double" type. Both l[l]round and l[l]roundf return long type. So these
- functions have identical signatures and functionality, and can use a
- single implementation. */
-libc_ifunc (__llroundf,
- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
- ? __llround_power8 :
- (hwcap & PPC_FEATURE_POWER6_EXT)
- ? __llround_power6x
- : __llroundf_ppc64);
-
-libm_alias_float (__llround, llround)
-strong_alias (__llroundf, __lroundf)
-libm_alias_float (__lround, lround)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c
deleted file mode 100644
index 0dab5443e2..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c
+++ /dev/null
@@ -1 +0,0 @@
-/* __lround is in s_llround.c */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
deleted file mode 100644
index 7180779921..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S
+++ /dev/null
@@ -1,86 +0,0 @@
-/* llround 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"
-
-/* long long [r3] llround (double x [fp1])
- IEEE 1003.1 llround 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.
-
- It is necessary to detect when x is (+-)0x1.fffffffffffffp-2
- because adding +-0.5 in this case will cause an erroneous shift,
- carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise
- if x is and odd number between +-(2^52 and 2^53-1) a shift and
- carry will erroneously round if biased with +-0.5. Therefore if x
- is greater/less than +-2^52 we don't need to bias the number with
- +-0.5. */
-
-ENTRY (__llround)
- CALL_MCOUNT 0
- lfd fp9,.LC0@toc(2) /* Load 2^52 into fpr9. */
- lfd fp10,.LC1@toc(2)/* Load 0.5 into fpr10. */
- fabs fp2,fp1 /* Get the absolute value of x. */
- fsub fp12,fp10,fp10 /* Compute 0.0 into fp12. */
- fcmpu cr6,fp2,fp10 /* if |x| < 0.5 */
- fcmpu cr7,fp2,fp9 /* if |x| >= 2^52 */
- fcmpu cr1,fp1,fp12 /* x is negative? x < 0.0 */
- blt- cr6,.Lretzero /* 0.5 > x < -0.5 so just return 0. */
- bge- cr7,.Lnobias /* 2^52 > x < -2^52 just convert with no bias. */
- /* Test whether an integer to avoid spurious "inexact". */
- fadd fp3,fp2,fp9
- fsub fp3,fp3,fp9
- fcmpu cr5,fp2,fp3
- beq cr5,.Lnobias
- fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */
- bge cr1,.Lconvert /* x is positive so don't negate x. */
- fnabs fp3,fp3 /* -(|x|+=0.5) */
-.Lconvert:
- fctidz fp4,fp3 /* Convert to Integer double word round toward 0. */
- stfd fp4,-16(r1)
- nop
- nop
- nop
- ld r3,-16(r1) /* Load return as integer. */
-.Lout:
- blr
-.Lretzero: /* 0.5 > x > -0.5 */
- li r3,0 /* return 0. */
- b .Lout
-.Lnobias:
- fmr fp3,fp1
- b .Lconvert
- END (__llround)
-
-strong_alias (__llround, __lround)
-libm_alias_double (__llround, llround)
-libm_alias_double (__lround, lround)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.c b/sysdeps/powerpc/powerpc64/fpu/s_llround.c
new file mode 100644
index 0000000000..6aa8fea195
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.c
@@ -0,0 +1,83 @@
+/* Round to nearest integer. PowerPC64 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