mirror of git://sourceware.org/git/glibc.git
math: Use internal feupdateenv 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:
parent
5624ee0482
commit
08c68809d0
|
@ -56,7 +56,7 @@ __fma (double x, double y, double z)
|
||||||
u.d = temp + (long double) z;
|
u.d = temp + (long double) z;
|
||||||
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
/* And finally truncation with round to nearest. */
|
/* And finally truncation with round to nearest. */
|
||||||
return (double) u.d;
|
return (double) u.d;
|
||||||
#endif /* ! USE_FMA_BUILTIN */
|
#endif /* ! USE_FMA_BUILTIN */
|
||||||
|
|
|
@ -223,7 +223,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
|
||||||
/* If the result is an exact zero, ensure it has the correct sign. */
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
if (a1 == 0 && m2 == 0)
|
if (a1 == 0 && m2 == 0)
|
||||||
{
|
{
|
||||||
feupdateenv (&env);
|
__feupdateenv (&env);
|
||||||
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
z = math_opt_barrier (z);
|
z = math_opt_barrier (z);
|
||||||
return z + m1;
|
return z + m1;
|
||||||
|
@ -237,7 +237,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
|
||||||
{
|
{
|
||||||
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
/* Result is a1 + u.d. */
|
/* Result is a1 + u.d. */
|
||||||
return a1 + u.d;
|
return a1 + u.d;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
|
||||||
{
|
{
|
||||||
if ((u.ieee.mantissa3 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
/* Result is a1 + u.d, scaled up. */
|
/* Result is a1 + u.d, scaled up. */
|
||||||
return (a1 + u.d) * L(0x1p113);
|
return (a1 + u.d) * L(0x1p113);
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
|
||||||
/* Ensure the addition is not scheduled after fetestexcept call. */
|
/* Ensure the addition is not scheduled after fetestexcept call. */
|
||||||
math_force_eval (v.d);
|
math_force_eval (v.d);
|
||||||
int j = fetestexcept (FE_INEXACT) != 0;
|
int j = fetestexcept (FE_INEXACT) != 0;
|
||||||
feupdateenv (&env);
|
__feupdateenv (&env);
|
||||||
/* Ensure the following computations are performed in default rounding
|
/* Ensure the following computations are performed in default rounding
|
||||||
mode instead of just reusing the round to zero computation. */
|
mode instead of just reusing the round to zero computation. */
|
||||||
asm volatile ("" : "=m" (u) : "m" (u));
|
asm volatile ("" : "=m" (u) : "m" (u));
|
||||||
|
|
|
@ -80,7 +80,7 @@ __fma (double x, double y, double z)
|
||||||
/* If the result is an exact zero, ensure it has the correct sign. */
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
if (a1 == 0 && m2 == 0)
|
if (a1 == 0 && m2 == 0)
|
||||||
{
|
{
|
||||||
feupdateenv (&env);
|
__feupdateenv (&env);
|
||||||
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
z = math_opt_barrier (z);
|
z = math_opt_barrier (z);
|
||||||
return z + m1;
|
return z + m1;
|
||||||
|
@ -95,7 +95,7 @@ __fma (double x, double y, double z)
|
||||||
u.d = a1 + a2;
|
u.d = a1 + a2;
|
||||||
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
|
|
||||||
/* Add finally round to double precision. */
|
/* Add finally round to double precision. */
|
||||||
return u.d;
|
return u.d;
|
||||||
|
|
|
@ -213,7 +213,7 @@ __fmal (long double x, long double y, long double z)
|
||||||
/* If the result is an exact zero, ensure it has the correct sign. */
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
if (a1 == 0 && m2 == 0)
|
if (a1 == 0 && m2 == 0)
|
||||||
{
|
{
|
||||||
feupdateenv (&env);
|
__feupdateenv (&env);
|
||||||
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
z = math_opt_barrier (z);
|
z = math_opt_barrier (z);
|
||||||
return z + m1;
|
return z + m1;
|
||||||
|
@ -227,7 +227,7 @@ __fmal (long double x, long double y, long double z)
|
||||||
{
|
{
|
||||||
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
/* Result is a1 + u.d. */
|
/* Result is a1 + u.d. */
|
||||||
return a1 + u.d;
|
return a1 + u.d;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ __fmal (long double x, long double y, long double z)
|
||||||
{
|
{
|
||||||
if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0x7fff)
|
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);
|
__feupdateenv (&env);
|
||||||
/* Result is a1 + u.d, scaled up. */
|
/* Result is a1 + u.d, scaled up. */
|
||||||
return (a1 + u.d) * 0x1p64L;
|
return (a1 + u.d) * 0x1p64L;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ __fmal (long double x, long double y, long double z)
|
||||||
/* Ensure the addition is not scheduled after fetestexcept call. */
|
/* Ensure the addition is not scheduled after fetestexcept call. */
|
||||||
math_force_eval (v.d);
|
math_force_eval (v.d);
|
||||||
int j = fetestexcept (FE_INEXACT) != 0;
|
int j = fetestexcept (FE_INEXACT) != 0;
|
||||||
feupdateenv (&env);
|
__feupdateenv (&env);
|
||||||
/* Ensure the following computations are performed in default rounding
|
/* Ensure the following computations are performed in default rounding
|
||||||
mode instead of just reusing the round to zero computation. */
|
mode instead of just reusing the round to zero computation. */
|
||||||
asm volatile ("" : "=m" (u) : "m" (u));
|
asm volatile ("" : "=m" (u) : "m" (u));
|
||||||
|
|
Loading…
Reference in New Issue