diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2015-01-27 13:16:39 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2015-01-28 05:59:16 -0500 |
commit | 08cee2a464f614a6d4275b5af6c52481f1aa16e6 (patch) | |
tree | e0a0b946ed40ac3c884db74de69b7cf291194808 /sysdeps/powerpc/fpu/e_sqrtf.c | |
parent | 5fe8e3597562ac8e0e3df1399ebf804f72e7f661 (diff) | |
download | glibc-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/e_sqrtf.c')
-rw-r--r-- | sysdeps/powerpc/fpu/e_sqrtf.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index 5cf47f707e..034b6f58ca 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -24,6 +24,7 @@ #include <sysdep.h> #include <ldsodefs.h> +#ifndef _ARCH_PPCSQ static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; @@ -128,6 +129,7 @@ __slow_ieee754_sqrtf (float x) } return f_washf (x); } +#endif /* _ARCH_PPCSQ */ #undef __ieee754_sqrtf float @@ -135,16 +137,11 @@ __ieee754_sqrtf (float 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 (" fsqrts %0,%1\n" - :"=f" (z):"f" (x)); - } - else - z = __slow_ieee754_sqrtf (x); +#ifdef _ARCH_PPCSQ + asm ("fsqrts %0,%1\n" :"=f" (z):"f" (x)); +#else + z = __slow_ieee754_sqrtf (x); +#endif return z; } |