summaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc32/fpu/s_llrintf.c')
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_llrintf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
index c5e78fa050..c6accb8d48 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
@@ -1,5 +1,5 @@
/* Round a float value to a long long in the current rounding mode.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-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
@@ -14,7 +14,7 @@
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/>. */
+ <https://www.gnu.org/licenses/>. */
#include <math.h>
#include <math_private.h>
@@ -24,7 +24,13 @@
long long int
__llrintf (float x)
{
- float rx = __rintf (x);
+#ifdef _ARCH_PWR4
+ /* Assume powerpc64 instructions availability. */
+ long long int ret;
+ __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x));
+ return ret;
+#else
+ float rx = rintf (x);
if (HAVE_PPC_FCTIDZ || rx != x)
return (long long int) rx;
else
@@ -43,5 +49,6 @@ __llrintf (float x)
mant <<= exponent - 23;
return (long long int) ((i0 & 0x80000000) != 0 ? -mant : mant);
}
+#endif
}
libm_alias_float (__llrint, llrint)