public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: libc-ports@sourceware.org
Subject: Use dbl-64 fma for MIPS64
Date: Fri, 01 Jun 2012 20:03:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1206011956470.11593@digraph.polyomino.org.uk> (raw)

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

                 reply	other threads:[~2012-06-01 20:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1206011956470.11593@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).