From: Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <Claudiu.Zissulescu@synopsys.com>, <gnu@amylaar.uk>,
<Francois.Bedard@synopsys.com>, <jeremy.bennett@embecosm.com>
Subject: [PATCH] [ARC] Handle FPX NaN within optimized floating point library.
Date: Fri, 29 Apr 2016 10:18:00 -0000 [thread overview]
Message-ID: <1461924998-9190-1-git-send-email-claziss@synopsys.com> (raw)
In-Reply-To: <5722261F.1070102@amylaar.uk>
This is the updated patch on handling FPX NaNs.
Ok to apply?
Claudiu
gcc/
2016-04-18 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gcc.target/arc/ieee_eq.c: New test.
libgcc/
2016-04-18 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/ieee-754/eqdf2.S: Handle FPX NaN.
---
gcc/testsuite/gcc.target/arc/ieee_eq.c | 47 ++++++++++++++++++++++++++++++++++
libgcc/config/arc/ieee-754/eqdf2.S | 15 +++++++----
2 files changed, 57 insertions(+), 5 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/arc/ieee_eq.c
diff --git a/gcc/testsuite/gcc.target/arc/ieee_eq.c b/gcc/testsuite/gcc.target/arc/ieee_eq.c
new file mode 100644
index 0000000..70aebad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/ieee_eq.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <stdio.h>
+#include <float.h>
+
+#define TEST_EQ(TYPE,X,Y,RES) \
+ do { \
+ volatile TYPE a, b; \
+ a = (TYPE) X; \
+ b = (TYPE) Y; \
+ if ((a == b) != RES) \
+ { \
+ printf ("Runtime computation error @%d. %g " \
+ "!= %g\n", __LINE__, a, b); \
+ error = 1; \
+ } \
+ } while (0)
+
+#ifndef __HS__
+/* Special type of NaN found when using double FPX instructions. */
+static const unsigned long long __nan = 0x7FF0000080000000ULL;
+# define W (*(double *) &__nan)
+#else
+# define W __builtin_nan ("")
+#endif
+
+#define Q __builtin_nan ("")
+#define H __builtin_inf ()
+
+int main (void)
+{
+ int error = 0;
+
+ TEST_EQ (double, 1, 1, 1);
+ TEST_EQ (double, 1, 2, 0);
+ TEST_EQ (double, W, W, 0);
+ TEST_EQ (double, Q, Q, 0);
+ TEST_EQ (double, __DBL_MAX__, __DBL_MAX__, 1);
+ TEST_EQ (double, __DBL_MIN__, __DBL_MIN__, 1);
+ TEST_EQ (double, H, H, 1);
+
+ if (error)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/libgcc/config/arc/ieee-754/eqdf2.S b/libgcc/config/arc/ieee-754/eqdf2.S
index bc7d88e..7e80ef5 100644
--- a/libgcc/config/arc/ieee-754/eqdf2.S
+++ b/libgcc/config/arc/ieee-754/eqdf2.S
@@ -58,11 +58,16 @@ __eqdf2:
well predictable (as seen from the branch predictor). */
__eqdf2:
brne.d DBL0H,DBL1H,.Lhighdiff
- bmsk r12,DBL0H,20
-#ifdef DPFP_COMPAT
- or.f 0,DBL0L,DBL1L
- bset.ne r12,r12,21
-#endif /* DPFP_COMPAT */
+#ifndef __HS__
+ /* The next two instructions are required to recognize the FPX
+ NaN, which has a pattern like this: 0x7ff0_0000_8000_0000, as
+ oposite to 0x7ff8_0000_0000_0000. */
+ or.f 0,DBL0L,DBL1L
+ mov_s r12,0x00200000
+ bset.ne r12,r12,0
+#else
+ bmsk r12,DBL0H,20
+#endif /* __HS__ */
add1.f r12,r12,DBL0H /* set c iff NaN; also, clear z if NaN. */
j_s.d [blink]
cmp.cc DBL0L,DBL1L
--
1.9.1
next prev parent reply other threads:[~2016-04-29 10:18 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 14:35 [PATCH 0/6] [ARC] Various fixes Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 3/6] [ARC] Pass mfpuda to assembler Claudiu Zissulescu
2016-04-28 10:30 ` Joern Wolfgang Rennecke
2016-04-28 13:10 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 2/6] [ARC] Fix FPX/FPUDA code gen when compiling for big-endian Claudiu Zissulescu
2016-04-28 10:29 ` Joern Wolfgang Rennecke
2016-04-28 12:54 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 6/6] [ARC] Various instruction pattern fixes Claudiu Zissulescu
2016-04-18 18:26 ` Claudiu Zissulescu
2016-04-28 12:31 ` Joern Wolfgang Rennecke
2016-05-02 11:21 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 4/6] [ARC] Handle FPX NaN within optimized floating point library Claudiu Zissulescu
2016-04-28 11:27 ` Joern Wolfgang Rennecke
2016-04-28 11:35 ` Claudiu Zissulescu
2016-04-28 11:41 ` Joern Wolfgang Rennecke
2016-04-28 11:43 ` Claudiu Zissulescu
2016-04-28 14:12 ` Claudiu Zissulescu
2016-04-28 15:03 ` Joern Wolfgang Rennecke
2016-04-29 10:18 ` Claudiu Zissulescu [this message]
2016-04-29 10:23 ` [PATCH] " Joern Wolfgang Rennecke
2016-04-29 10:27 ` Joern Wolfgang Rennecke
2016-04-29 10:31 ` Claudiu Zissulescu
2016-04-29 10:37 ` Joern Wolfgang Rennecke
2016-04-29 10:47 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 5/6] [ARC] Fix unwanted match for sign extend 16-bit constant Claudiu Zissulescu
2016-04-28 11:47 ` Joern Wolfgang Rennecke
2016-04-28 17:12 ` [PATCH] " Claudiu Zissulescu
2016-04-28 17:46 ` Joern Wolfgang Rennecke
2016-04-28 20:31 ` Claudiu Zissulescu
2016-04-28 20:57 ` Joern Wolfgang Rennecke
2016-04-29 8:41 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 1/6] [ARC] Don't use drsub* instructions when selecting fpuda Claudiu Zissulescu
2016-04-28 10:05 ` Joern Wolfgang Rennecke
2016-04-28 12:16 ` Claudiu Zissulescu
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=1461924998-9190-1-git-send-email-claziss@synopsys.com \
--to=claudiu.zissulescu@synopsys.com \
--cc=Francois.Bedard@synopsys.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gnu@amylaar.uk \
--cc=jeremy.bennett@embecosm.com \
/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).