* Use dbl-64 fma for MIPS64
@ 2012-06-01 20:03 Joseph S. Myers
0 siblings, 0 replies; only message in thread
From: Joseph S. Myers @ 2012-06-01 20:03 UTC (permalink / raw)
To: libc-ports
On MIPS64, long double is always implemented in software - and currently
this is fp-bit with no integration with hardware exceptions and rounding
modes. Using the ldbl-128 implementation of (double) fma is thus both
slow and not correctly rounding (since that implementation relies on
rounding modes and exceptions); as on SPARC, it's better the use the
dbl-64 implementation and ignore the existence of long double.
I've applied this patch to do so, which gets clean results for test-float
/ test-double / test-ifloat / test-idouble (previously some fma tests
failed to be correctly rounding). (For the soft-float MIPS64 case, I
don't know which implementation would be faster - lack of rounding modes
and exceptions means neither would be correctly rounding - but I don't see
any real reason to make soft-float do something different from hard-float
here until we have a generic fma implementation (bug 13304), at which
point we can make hard-float use the dbl-64 code and soft-float use the
new generic implementation.)
diff --git a/ChangeLog.mips b/ChangeLog.mips
index 5cd25e7..853f286 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,5 +1,8 @@
2012-06-01 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/mips/mips64/n32/s_fma.c: New file.
+ * sysdeps/mips/mips64/n64/s_fma.c: Likewise.
+
* sysdeps/unix/sysv/linux/mips/Makefile (abi-n32-condition): Fix
typo.
diff --git a/sysdeps/mips/mips64/n32/s_fma.c b/sysdeps/mips/mips64/n32/s_fma.c
new file mode 100644
index 0000000..74a1e01
--- /dev/null
+++ b/sysdeps/mips/mips64/n32/s_fma.c
@@ -0,0 +1,6 @@
+/* MIPS long double is implemented in software by fp-bit (as of GCC
+ 4.7) without support for exceptions or rounding modes, so the fma
+ implementation in terms of long double is slow and will not produce
+ correctly rounding results. */
+
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/mips/mips64/n64/s_fma.c b/sysdeps/mips/mips64/n64/s_fma.c
new file mode 100644
index 0000000..74a1e01
--- /dev/null
+++ b/sysdeps/mips/mips64/n64/s_fma.c
@@ -0,0 +1,6 @@
+/* MIPS long double is implemented in software by fp-bit (as of GCC
+ 4.7) without support for exceptions or rounding modes, so the fma
+ implementation in terms of long double is slow and will not produce
+ correctly rounding results. */
+
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-06-01 20:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01 20:03 Use dbl-64 fma for MIPS64 Joseph S. Myers
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).