mirror of git://sourceware.org/git/glibc.git
Force eval for fma implementations
This commit is contained in:
parent
6f64e7d75f
commit
4896f04920
|
|
@ -1,3 +1,12 @@
|
||||||
|
2014-08-01 Richard Henderon <rth@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Use math_force_eval before
|
||||||
|
feclearexcept; use math_opt_barrier instead of open-coded asm; fix
|
||||||
|
typo in exact zero test.
|
||||||
|
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.
|
||||||
|
|
||||||
2014-08-01 Roland McGrath <roland@hack.frob.com>
|
2014-08-01 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/arm/sysdep.h (PTR_MANGLE_LOAD, PTR_MANGLE)
|
* sysdeps/unix/sysv/linux/arm/sysdep.h (PTR_MANGLE_LOAD, PTR_MANGLE)
|
||||||
|
|
|
||||||
|
|
@ -198,16 +198,17 @@ __fma (double x, double y, double z)
|
||||||
t1 = m1 - t1;
|
t1 = m1 - t1;
|
||||||
t2 = z - t2;
|
t2 = z - t2;
|
||||||
double a2 = t1 + t2;
|
double a2 = t1 + t2;
|
||||||
|
/* Ensure the arithmetic is not scheduled after feclearexcept call. */
|
||||||
|
math_force_eval (m2);
|
||||||
|
math_force_eval (a2);
|
||||||
feclearexcept (FE_INEXACT);
|
feclearexcept (FE_INEXACT);
|
||||||
|
|
||||||
/* If the result is an exact zero, ensure it has the correct
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
sign. */
|
|
||||||
if (a1 == 0 && m2 == 0)
|
if (a1 == 0 && m2 == 0)
|
||||||
{
|
{
|
||||||
libc_feupdateenv (&env);
|
libc_feupdateenv (&env);
|
||||||
/* Ensure that round-to-nearest value of z + m1 is not
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
reused. */
|
z = math_opt_barrier (z);
|
||||||
asm volatile ("" : "=m" (z) : "m" (z));
|
|
||||||
return z + m1;
|
return z + m1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,16 +203,17 @@ __fmal (long double x, long double y, long double z)
|
||||||
t1 = m1 - t1;
|
t1 = m1 - t1;
|
||||||
t2 = z - t2;
|
t2 = z - t2;
|
||||||
long double a2 = t1 + t2;
|
long double a2 = t1 + t2;
|
||||||
|
/* Ensure the arithmetic is not scheduled after feclearexcept call. */
|
||||||
|
math_force_eval (m2);
|
||||||
|
math_force_eval (a2);
|
||||||
feclearexcept (FE_INEXACT);
|
feclearexcept (FE_INEXACT);
|
||||||
|
|
||||||
/* If the result is an exact zero, ensure it has the correct
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
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
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
reused. */
|
z = math_opt_barrier (z);
|
||||||
asm volatile ("" : "=m" (z) : "m" (z));
|
|
||||||
return z + m1;
|
return z + m1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,16 +64,17 @@ __fma (double x, double y, double z)
|
||||||
t1 = m1 - t1;
|
t1 = m1 - t1;
|
||||||
t2 = z - t2;
|
t2 = z - t2;
|
||||||
long double a2 = t1 + t2;
|
long double a2 = t1 + t2;
|
||||||
|
/* Ensure the arithmetic is not scheduled after feclearexcept call. */
|
||||||
|
math_force_eval (m2);
|
||||||
|
math_force_eval (a2);
|
||||||
feclearexcept (FE_INEXACT);
|
feclearexcept (FE_INEXACT);
|
||||||
|
|
||||||
/* If the result is an exact zero, ensure it has the correct
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
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
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
reused. */
|
z = math_opt_barrier (z);
|
||||||
asm volatile ("" : "=m" (z) : "m" (z));
|
|
||||||
return z + m1;
|
return z + m1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,16 +201,17 @@ __fmal (long double x, long double y, long double z)
|
||||||
t1 = m1 - t1;
|
t1 = m1 - t1;
|
||||||
t2 = z - t2;
|
t2 = z - t2;
|
||||||
long double a2 = t1 + t2;
|
long double a2 = t1 + t2;
|
||||||
|
/* Ensure the arithmetic is not scheduled after feclearexcept call. */
|
||||||
|
math_force_eval (m2);
|
||||||
|
math_force_eval (a2);
|
||||||
feclearexcept (FE_INEXACT);
|
feclearexcept (FE_INEXACT);
|
||||||
|
|
||||||
/* If the result is an exact zero, ensure it has the correct
|
/* If the result is an exact zero, ensure it has the correct sign. */
|
||||||
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
|
/* Ensure that round-to-nearest value of z + m1 is not reused. */
|
||||||
reused. */
|
z = math_opt_barrier (z);
|
||||||
asm volatile ("" : "=m" (z) : "m" (z));
|
|
||||||
return z + m1;
|
return z + m1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue