Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Call math_opt_barrier inside if
Since floating-point operation may trigger floating-point exceptions,
we call math_opt_barrier inside if to prevent code motion.

	[BZ #19465]
	* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Call math_opt_barrier
	inside if.
	* 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.
  • Loading branch information
H.J. Lu committed Jan 15, 2016
1 parent 82c9a4f commit 0924537
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,3 +1,12 @@
2016-01-15 H.J. Lu <hongjiu.lu@intel.com>

[BZ #19465]
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Call math_opt_barrier
inside if.
* 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.

2016-01-14 H.J. Lu <hongjiu.lu@intel.com>

[BZ #19466]
Expand Down
5 changes: 4 additions & 1 deletion sysdeps/ieee754/dbl-64/s_fma.c
Expand Up @@ -175,7 +175,10 @@ __fma (double x, double y, double z)

/* Ensure correct sign of exact 0 + 0. */
if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
{
x = math_opt_barrier (x);
return x * y + z;
}

fenv_t env;
libc_feholdexcept_setround (&env, FE_TONEAREST);
Expand Down
5 changes: 4 additions & 1 deletion sysdeps/ieee754/ldbl-128/s_fmal.c
Expand Up @@ -179,7 +179,10 @@ __fmal (long double x, long double y, long double z)

/* Ensure correct sign of exact 0 + 0. */
if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
{
x = math_opt_barrier (x);
return x * y + z;
}

fenv_t env;
feholdexcept (&env);
Expand Down
5 changes: 4 additions & 1 deletion sysdeps/ieee754/ldbl-96/s_fma.c
Expand Up @@ -41,7 +41,10 @@ __fma (double x, double y, double z)

/* Ensure correct sign of exact 0 + 0. */
if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
{
x = math_opt_barrier (x);
return x * y + z;
}

fenv_t env;
feholdexcept (&env);
Expand Down
5 changes: 4 additions & 1 deletion sysdeps/ieee754/ldbl-96/s_fmal.c
Expand Up @@ -177,7 +177,10 @@ __fmal (long double x, long double y, long double z)

/* Ensure correct sign of exact 0 + 0. */
if (__glibc_unlikely ((x == 0 || y == 0) && z == 0))
return x * y + z;
{
x = math_opt_barrier (x);
return x * y + z;
}

fenv_t env;
feholdexcept (&env);
Expand Down

0 comments on commit 0924537

Please sign in to comment.