about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-03-18 02:01:03 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-06-17 09:27:02 -0300
commit2166283fcc8ba3b4a4505acd2a91f2e7decf689c (patch)
tree961121341f98f1464fec4d4962398bb9422b0672 /sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
parent78049de0a995df1a81c934c186816e4114aed4bd (diff)
downloadglibc-2166283fcc8ba3b4a4505acd2a91f2e7decf689c.tar.gz
glibc-2166283fcc8ba3b4a4505acd2a91f2e7decf689c.tar.xz
glibc-2166283fcc8ba3b4a4505acd2a91f2e7decf689c.zip
powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf
This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llrint{f}.

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-cpu and with --with-cpu=power5+
and --disable-multi-arch).

	* sysdeps/powerpc/fpu/s_lrintf.S: Remove file.
	* sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Move to ...
	* sysdeps/powerpc/fpu/s_lrintf.c: ... here.
	* sysdeps/powerpc/powerpc32/fpu/Makefile
	[$(subdir) == math] (CFLAGS-s_lrint.c): New rule.
	* sysdeps/powerpc/powerpc32/fpu/s_llrint.c (__llrint): Add power4
	optimization.
	* sysdeps/powerpc/powerpc32/fpu/s_llrintf.c (__llrintf): Likewise.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Remove file.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.c: New file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
	(CFLAGS-s_llrintf-power6.c, CFLAGS-s_llrintf-ppc32.c,
	CFLAGS-s_llrint-power6.c, CFLAGS-s_llrint-ppc32.c,
	CFLAGS-s_lrint-ppc32.c): New rule.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S:
	Remove file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c:
	New file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c:
	Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/powerpc32/fpu/s_llrintf.c')
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_llrintf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
index 021a86fada..b75655e2c1 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
@@ -24,6 +24,12 @@
 long long int
 __llrintf (float 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;
@@ -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)