From d9a8d0abcc976f7ffe319a376ddd3497486e9726 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 18 Oct 2011 15:11:31 -0400 Subject: Use new internal libc_fe* interfaces in more functions --- sysdeps/ieee754/dbl-64/s_fma.c | 22 +++++++++++----------- sysdeps/ieee754/dbl-64/s_fmaf.c | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sysdeps/ieee754/dbl-64') diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c index 3b0bfd5ce6..14c6503de2 100644 --- a/sysdeps/ieee754/dbl-64/s_fma.c +++ b/sysdeps/ieee754/dbl-64/s_fma.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2010. @@ -22,6 +22,7 @@ #include #include #include +#include /* This implementation uses rounding to odd to avoid problems with double rounding. See a paper by Boldo and Melquiond: @@ -47,7 +48,7 @@ __fma (double x, double y, double z) z rather than NaN. */ if (w.ieee.exponent == 0x7ff && u.ieee.exponent != 0x7ff - && v.ieee.exponent != 0x7ff) + && v.ieee.exponent != 0x7ff) return (z + x) + y; /* If x or y or z is Inf/NaN, or if fma will certainly overflow, or if x * y is less than half of DBL_DENORM_MIN, @@ -148,34 +149,33 @@ __fma (double x, double y, double z) double a2 = t1 + t2; fenv_t env; - feholdexcept (&env); - fesetround (FE_TOWARDZERO); + libc_feholdexcept_setround (&env, FE_TOWARDZERO); /* Perform m2 + a2 addition with round to odd. */ u.d = a2 + m2; if (__builtin_expect (adjust == 0, 1)) { if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff) - u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0; - feupdateenv (&env); + u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0; + libc_feupdateenv (&env); /* Result is a1 + u.d. */ return a1 + u.d; } else if (__builtin_expect (adjust > 0, 1)) { if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff) - u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0; - feupdateenv (&env); + u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0; + libc_feupdateenv (&env); /* Result is a1 + u.d, scaled up. */ return (a1 + u.d) * 0x1p53; } else { if ((u.ieee.mantissa1 & 1) == 0) - u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0; + u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0; v.d = a1 + u.d; - int j = fetestexcept (FE_INEXACT) != 0; - feupdateenv (&env); + int j = libc_fetestexcept (FE_INEXACT) != 0; + libc_feupdateenv (&env); /* Ensure the following computations are performed in default rounding mode instead of just reusing the round to zero computation. */ asm volatile ("" : "=m" (u) : "m" (u)); diff --git a/sysdeps/ieee754/dbl-64/s_fmaf.c b/sysdeps/ieee754/dbl-64/s_fmaf.c index cd16cd1dce..dc748e5548 100644 --- a/sysdeps/ieee754/dbl-64/s_fmaf.c +++ b/sysdeps/ieee754/dbl-64/s_fmaf.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2010. @@ -21,6 +21,7 @@ #include #include #include +#include /* This implementation relies on double being more than twice as precise as float and uses rounding to odd in order to avoid problems @@ -35,13 +36,12 @@ __fmaf (float x, float y, float z) /* Multiplication is always exact. */ double temp = (double) x * (double) y; union ieee754_double u; - feholdexcept (&env); - fesetround (FE_TOWARDZERO); + libc_feholdexcept_setroundf (&env, FE_TOWARDZERO); /* Perform addition with round to odd. */ u.d = temp + (double) z; if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7ff) - u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0; - feupdateenv (&env); + u.ieee.mantissa1 |= libc_fetestexcept (FE_INEXACT) != 0; + libc_feupdateenv (&env); /* And finally truncation with round to nearest. */ return (float) u.d; } -- cgit v1.2.3