public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tile: use ieee754/dbl-64 version of fma() and fmaf()
@ 2012-05-17 15:38 Chris Metcalf
  0 siblings, 0 replies; only message in thread
From: Chris Metcalf @ 2012-05-17 15:38 UTC (permalink / raw)
  To: libc-ports

It turns out that even if you stub out the rounding and exception
support and use the ieee754 version, it's still much better than
the generic version that just uses normal multiply and add.
The resulting functions have only 1 ULP of error according to the tests.
---
I'll push this change as obviously reasonable, and update the ulps
file as well (also updating to catch the improved exp10() ulps).

 ChangeLog.tile        |    5 +++++
 sysdeps/tile/s_fma.c  |   11 ++++++++---
 sysdeps/tile/s_fmaf.c |   11 ++++++++---
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/ChangeLog.tile b/ChangeLog.tile
index b800112..7d3c7bd 100644
--- a/ChangeLog.tile
+++ b/ChangeLog.tile
@@ -1,3 +1,8 @@
+2012-05-17  Chris Metcalf  <cmetcalf@tilera.com>
+
+	* sysdeps/tile/s_fma.c: Use ieee754/dbl-64 without rounding or
+	exception support; it's still much better than the generic version.
+
 2012-05-16  Chris Metcalf  <cmetcalf@tilera.com>
 
 	* sysdeps/unix/sysv/linux/tile/ucontext_i: Fix tilegx32 offset bug.
diff --git a/sysdeps/tile/s_fma.c b/sysdeps/tile/s_fma.c
index 355b4ed..5be5865 100644
--- a/sysdeps/tile/s_fma.c
+++ b/sysdeps/tile/s_fma.c
@@ -1,3 +1,8 @@
-/* Although tile uses ieee754/dbl-64, it does not support the
-   rounding modes required to use the standard dbl-64 s_fma.c.  */
-#include <math/s_fma.c>
+/* tile does not support the rounding modes required by the ieee754/dbl-64
+   implementation, but it's still better than the generic implementation.  */
+
+#define libc_feholdexcept_setround(e, x) do { (void) (e); } while (0)
+#define libc_feupdateenv_test(e, x) ((void) (e), 0)
+#define libc_fetestexcept(x) 0
+
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/tile/s_fmaf.c b/sysdeps/tile/s_fmaf.c
index caa8e40..92d66b2 100644
--- a/sysdeps/tile/s_fmaf.c
+++ b/sysdeps/tile/s_fmaf.c
@@ -1,3 +1,8 @@
-/* Although tile uses ieee754/dbl-64, it does not support the
-   rounding modes required to use the standard dbl-64 s_fmaf.c.  */
-#include <math/s_fmaf.c>
+/* tile does not support the rounding modes required by the ieee754/dbl-64
+   implementation, but it's still better than the generic implementation.  */
+
+#define libc_feholdexcept_setround(e, x) do { (void) (e); } while (0)
+#define libc_feupdateenv_test(e, x) ((void) (e), 0)
+#define libc_fetestexcept(x) 0
+
+#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
-- 
1.6.5.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-17 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-17 15:38 [PATCH] tile: use ieee754/dbl-64 version of fma() and fmaf() Chris Metcalf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).