math: Use internal fetestexcept alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
Adhemerval Zanella 2025-08-25 13:38:31 -03:00
parent 63ba1a1509
commit adecb3bec1
4 changed files with 10 additions and 10 deletions

View File

@ -55,7 +55,7 @@ __fma (double x, double y, double z)
/* Perform addition with round to odd. */
u.d = temp + (long double) z;
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa3 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* And finally truncation with round to nearest. */
return (double) u.d;

View File

@ -236,7 +236,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
if (__glibc_likely (adjust == 0))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa3 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Result is a1 + u.d. */
return a1 + u.d;
@ -244,7 +244,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
else if (__glibc_likely (adjust > 0))
{
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa3 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Result is a1 + u.d, scaled up. */
return (a1 + u.d) * L(0x1p113);
@ -252,11 +252,11 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
else
{
if ((u.ieee.mantissa3 & 1) == 0)
u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa3 |= __fetestexcept (FE_INEXACT) != 0;
v.d = a1 + u.d;
/* Ensure the addition is not scheduled after fetestexcept call. */
math_force_eval (v.d);
int j = fetestexcept (FE_INEXACT) != 0;
int j = __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Ensure the following computations are performed in default rounding
mode instead of just reusing the round to zero computation. */

View File

@ -94,7 +94,7 @@ __fma (double x, double y, double z)
union ieee854_long_double u;
u.d = a1 + a2;
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa1 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Add finally round to double precision. */

View File

@ -226,7 +226,7 @@ __fmal (long double x, long double y, long double z)
if (__glibc_likely (adjust == 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa1 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Result is a1 + u.d. */
return a1 + u.d;
@ -234,7 +234,7 @@ __fmal (long double x, long double y, long double z)
else if (__glibc_likely (adjust > 0))
{
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa1 |= __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Result is a1 + u.d, scaled up. */
return (a1 + u.d) * 0x1p64L;
@ -242,11 +242,11 @@ __fmal (long double x, long double y, long double z)
else
{
if ((u.ieee.mantissa1 & 1) == 0)
u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
u.ieee.mantissa1 |= __fetestexcept (FE_INEXACT) != 0;
v.d = a1 + u.d;
/* Ensure the addition is not scheduled after fetestexcept call. */
math_force_eval (v.d);
int j = fetestexcept (FE_INEXACT) != 0;
int j = __fetestexcept (FE_INEXACT) != 0;
__feupdateenv (&env);
/* Ensure the following computations are performed in default rounding
mode instead of just reusing the round to zero computation. */