This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Call math_opt_barrier inside if
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 14 Jan 2016 13:41:45 -0800
- Subject: [PATCH] Call math_opt_barrier inside if
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Since floating-point operation may trigger floating-point exceptions,
we call math_opt_barrier inside if to prevent code motion.
Tested on x86-64. OK for trunk?
H.J.
---
[BZ #19465]
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Call math_opt_barrier
inside if.
---
sysdeps/ieee754/dbl-64/s_fma.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c
index bc3677d..a349243 100644
--- a/sysdeps/ieee754/dbl-64/s_fma.c
+++ b/sysdeps/ieee754/dbl-64/s_fma.c
@@ -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);
--
2.5.0