]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Convert __ieee754_sqrt{,f} from macros to inlines.
authorRichard Henderson <rth@twiddle.net>
Wed, 7 Mar 2012 17:16:59 +0000 (09:16 -0800)
committerRichard Henderson <rth@twiddle.net>
Fri, 9 Mar 2012 19:16:18 +0000 (11:16 -0800)
ChangeLog
sysdeps/powerpc/fpu/math_private.h

index 59d7e9e8221baa1a97a7b322ed6b26367682bfc4..3cc0d2dab687bc9ac3cf6da7cabc3ff4bbf8a1e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-03-08  Richard Henderson  <rth@twiddle.net>
 
+       * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrt): Convert
+       from macro to inline function; merge with the
+       !__LIBC_INTERNAL_MATH_INLINES version.
+       (__ieee754_sqrtf): Likewise.
+
        * sysdeps/x86_64/fpu/math_private.h (__rint): Convert from macro
        to inline function.
        (__rintf, __floor, __floorf): Likewise.
index 7bacecb245e156bb8f5ca112a7c2a9413667e7e2..28628f05408e1d04bc3bfa51765caf53127647ce 100644 (file)
 #include <sysdep.h>
 #include <ldsodefs.h>
 #include <dl-procinfo.h>
-
 #include <math/math_private.h>
 
 # if __WORDSIZE == 64 || defined _ARCH_PWR4
 #  define __CPU_HAS_FSQRT 1
-
-#ifndef __ieee754_sqrt
-# define __ieee754_sqrt(x)             \
-  ({ double __z;                       \
-     __asm __volatile (                        \
-       "       fsqrt %0,%1\n"          \
-               : "=f" (__z)            \
-               : "f"(x));              \
-     __z; })
-#endif
-#ifndef __ieee754_sqrtf
-# define __ieee754_sqrtf(x)            \
-  ({ float __z;                                \
-     __asm __volatile (                        \
-       "       fsqrts %0,%1\n"         \
-               : "=f" (__z)            \
-               : "f"(x));              \
-     __z; })
-#endif
-
 # else
 #  define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
-# endif        // __WORDSIZE == 64 || defined _ARCH_PWR4
+# 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);
+
+  return __z;
+}
+
+extern float __slow_ieee754_sqrtf (float);
+extern __always_inline float
+__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);
+
+  return __z;
+}
 
 #if defined _ARCH_PWR5X
 
 
 #endif /* defined _ARCH_PWR6 */
 
-
-# ifndef __LIBC_INTERNAL_MATH_INLINES
-extern double __slow_ieee754_sqrt (double);
-__inline double
-__ieee754_sqrt (double __x)
-{
-  double __z;
-
-  /* If the CPU is 64-bit we can use the optional FP instructions.  */
-  if (__CPU_HAS_FSQRT)
-  {
-    /* Volatile is required to prevent the compiler from moving the
-       fsqrt instruction above the branch.  */
-     __asm __volatile (
-       "       fsqrt   %0,%1\n"
-               : "=f" (__z)
-               : "f" (__x));
-  }
-  else
-     __z = __slow_ieee754_sqrt(__x);
-
-  return __z;
-}
-
-extern float __slow_ieee754_sqrtf (float);
-
-__inline float
-__ieee754_sqrtf (float __x)
-{
-  float __z;
-
-  /* If the CPU is 64-bit we can use the optional FP instructions.  */
-  if (__CPU_HAS_FSQRT)
-  {
-    /* Volatile is required to prevent the compiler from moving the
-       fsqrts instruction above the branch.  */
-     __asm __volatile (
-       "       fsqrts  %0,%1\n"
-               : "=f" (__z)
-               : "f" (__x));
-  }
-  else
-     __z = __slow_ieee754_sqrtf(__x);
-
-  return __z;
-}
-#endif /* __LIBC_INTERNAL_MATH_INLINES */
-
 #endif /* _PPC_MATH_PRIVATE_H_ */