about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_fmal.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-01-15 05:22:59 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-01-15 05:23:20 -0800
commit09245377dac2c013155500ac0b3b05850813e3f8 (patch)
tree9cf9294f77070cd65b3c4c880714fd4e66ae191a /sysdeps/ieee754/ldbl-128/s_fmal.c
parent82c9a4f85e8522bc9e578725075d5c0535940b32 (diff)
downloadglibc-09245377dac2c013155500ac0b3b05850813e3f8.tar.gz
glibc-09245377dac2c013155500ac0b3b05850813e3f8.tar.xz
glibc-09245377dac2c013155500ac0b3b05850813e3f8.zip
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.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_fmal.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_fmal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index ac30027af9..728949c916 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -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);