about summary refs log tree commit diff
path: root/sysdeps/powerpc/fpu/math_private.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-01-27 13:16:39 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-01-28 05:59:16 -0500
commit08cee2a464f614a6d4275b5af6c52481f1aa16e6 (patch)
treee0a0b946ed40ac3c884db74de69b7cf291194808 /sysdeps/powerpc/fpu/math_private.h
parent5fe8e3597562ac8e0e3df1399ebf804f72e7f661 (diff)
downloadglibc-08cee2a464f614a6d4275b5af6c52481f1aa16e6.tar.gz
glibc-08cee2a464f614a6d4275b5af6c52481f1aa16e6.tar.xz
glibc-08cee2a464f614a6d4275b5af6c52481f1aa16e6.zip
powerpc: Fix fsqrt build in libm [BZ#16576]
Some powerpc64 processors (e5500 core for instance) does not provide the
fsqrt instruction, however current check to use in math_private.h is
__WORDSIZE and _ARCH_PWR4 (ISA 2.02).  This is patch change it to use
the compiler flag _ARCH_PPCSQ (which is the same condition GCC uses to
decide whether to generate fsqrt instruction).

It fixes BZ#16576.
Diffstat (limited to 'sysdeps/powerpc/fpu/math_private.h')
-rw-r--r--sysdeps/powerpc/fpu/math_private.h32
1 files changed, 10 insertions, 22 deletions
diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
index 6631535e82..37e7456bac 100644
--- a/sysdeps/powerpc/fpu/math_private.h
+++ b/sysdeps/powerpc/fpu/math_private.h
@@ -25,26 +25,17 @@
 #include <fenv_private.h>
 #include_next <math_private.h>
 
-# if __WORDSIZE == 64 || defined _ARCH_PWR4
-#  define __CPU_HAS_FSQRT 1
-# else
-#  define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
-# endif
-
 extern double __slow_ieee754_sqrt (double);
 extern __always_inline double
 __ieee754_sqrt (double __x)
 {
   double __z;
 
-  if (__CPU_HAS_FSQRT)
-    {
-      /* Volatile is required to prevent the compiler from moving the
-         fsqrt instruction above the branch.  */
-      __asm __volatile ("fsqrt	%0,%1" : "=f" (__z) : "f" (__x));
-    }
-  else
-     __z = __slow_ieee754_sqrt(__x);
+#ifdef _ARCH_PPCSQ
+   asm ("fsqrt	%0,%1" : "=f" (__z) : "f" (__x));
+#else
+   __z = __slow_ieee754_sqrt(__x);
+#endif
 
   return __z;
 }
@@ -55,14 +46,11 @@ __ieee754_sqrtf (float __x)
 {
   float __z;
 
-  if (__CPU_HAS_FSQRT)
-    {
-      /* Volatile is required to prevent the compiler from moving the
-         fsqrts instruction above the branch.  */
-      __asm __volatile ("fsqrts	%0,%1" : "=f" (__z) : "f" (__x));
-    }
-  else
-     __z = __slow_ieee754_sqrtf(__x);
+#ifdef _ARCH_PPCSQ
+  asm ("fsqrts	%0,%1" : "=f" (__z) : "f" (__x));
+#else
+   __z = __slow_ieee754_sqrtf(__x);
+#endif
 
   return __z;
 }