This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Make ieee754 fma tolerate architectures without exception support.
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 5 Nov 2012 11:36:09 -0500
- Subject: [PATCH] Make ieee754 fma tolerate architectures without exception support.
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