[PATCH] Make ieee754 fma tolerate architectures without exception support.
Chris Metcalf
cmetcalf@tilera.com
Mon Nov 5 17:47:00 GMT 2012
2012-11-05 Chris Metcalf <cmetcalf@tilera.com>
* sysdeps/ieee754/dbl-64/s_fma.c [!defined FE_INEXACT]:
Provide no-op defines for exception and rounding macros.
---
ChangeLog | 5 +++++
sysdeps/ieee754/dbl-64/s_fma.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 3ff6937..a44ff1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-05 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/ieee754/dbl-64/s_fma.c [!defined FE_INEXACT]:
+ Provide no-op defines for exception and rounding macros.
+
2012-11-05 Joseph Myers <joseph@codesourcery.com>
[BZ #14805]
diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c
index cd28830..6ceb925 100644
--- a/sysdeps/ieee754/dbl-64/s_fma.c
+++ b/sysdeps/ieee754/dbl-64/s_fma.c
@@ -28,6 +28,17 @@
double rounding. See a paper by Boldo and Melquiond:
http://www.lri.fr/~melquion/doc/08-tc.pdf */
+/* For IEEE754 architectures without exception support, tolerate imprecision
+ in __fma but allow using this implementation instead of the generic one.
+ Use statement expressions to avoid "statement with no effect" warnings. */
+#ifndef FE_INEXACT
+# define libc_feholdexcept_setround(env, exc) ({ (void) (env); 0; })
+# define libc_feupdateenv_test(env, exc) ({ (void) (env); 0; })
+# define libc_fesetround(rnd) ({ 0; })
+# define libc_fetestexcept(exc) ({ 0; })
+# define feclearexcept(exc) ({ 0; })
+#endif
+
double
__fma (double x, double y, double z)
{
--
1.7.10.3
More information about the Libc-alpha
mailing list