This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] tile: use ieee754/dbl-64 version of fma() and fmaf()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]