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]

Use dbl-64 fma for MIPS64


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


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