aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index 034b6f58ca..a684cf977a 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -87,26 +87,28 @@ __slow_ieee754_sqrtf (float x)
/* Here we have three Newton-Raphson iterations each of a
division and a square root and the remainder of the
argument reduction, all interleaved. */
- sd = -(sg * sg - sx);
+ sd = -__builtin_fmaf (sg, sg, -sx);
fsgi = (xi + 0x40000000) >> 1 & 0x7f800000;
sy2 = sy + sy;
- sg = sy * sd + sg; /* 16-bit approximation to sqrt(sx). */
- e = -(sy * sg - almost_half);
+ sg = __builtin_fmaf (sy, sd, sg); /* 16-bit approximation to
+ sqrt(sx). */
+ e = -__builtin_fmaf (sy, sg, -almost_half);
SET_FLOAT_WORD (fsg, fsgi);
- sd = -(sg * sg - sx);
- sy = sy + e * sy2;
+ sd = -__builtin_fmaf (sg, sg, -sx);
+ sy = __builtin_fmaf (e, sy2, sy);
if ((xi & 0x7f800000) == 0)
goto denorm;
shx = sx * fsg;
- sg = sg + sy * sd; /* 32-bit approximation to sqrt(sx),
- but perhaps rounded incorrectly. */
+ sg = __builtin_fmaf (sy, sd, sg); /* 32-bit approximation to
+ sqrt(sx), but perhaps
+ rounded incorrectly. */
sy2 = sy + sy;
g = sg * fsg;
- e = -(sy * sg - almost_half);
- d = -(g * sg - shx);
- sy = sy + e * sy2;
+ e = -__builtin_fmaf (sy, sg, -almost_half);
+ d = -__builtin_fmaf (g, sg, -shx);
+ sy = __builtin_fmaf (e, sy2, sy);
fesetenv_register (fe);
- return g + sy * d;
+ return __builtin_fmaf (sy, d, g);
denorm:
/* For denormalised numbers, we normalise, calculate the
square root, and return an adjusted result. */