All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 1/2] cgen: Add unordered compare operation
Date: Sat,  1 Jun 2019 16:26:28 +0900	[thread overview]
Message-ID: <20190601072629.4070-2-shorne@gmail.com> (raw)
In-Reply-To: <20190601072629.4070-1-shorne@gmail.com>

On OpenRISC we have added FPU unordered comparison operations (NaN
detection).  This patch adds the unordered operation which will generate
c hooks to be implemented in simulators.

An unordered comparison can now be defined as:

  ; Compare unordered (set flag if either r1 or r2 is NaN)
  (set BI flag (unordered WI r1 r2))

  ; Compare unordered, greater than or equal
  (set BI flag (or (unordered WI r1 r2)
		   (ge WI r1 r2)))

ChangeLog:

yyyy-mm-dd  Stafford Horne  <shorne@gmail.com>

	* rtl-c.scm (unordered): New comparison operation.
	* rtx-funcs.scm (unordered): New rtx node.
---
 rtl-c.scm     | 4 ++++
 rtx-funcs.scm | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/rtl-c.scm b/rtl-c.scm
index 1a4b8b0..4d4d671 100644
--- a/rtl-c.scm
+++ b/rtl-c.scm
@@ -1897,6 +1897,10 @@
 (define-fn geu (*estate* options mode s1 s2)
   (s-cmpop *estate* 'geu ">=" mode s1 s2)
 )
+(define-fn unordered (*estate* options mode s1 s2)
+  (s-cmpop *estate* 'unordered #f mode s1 s2)
+)
+
 
 (define-fn member (*estate* options mode value set)
   ;; NOTE: There are multiple evalutions of VALUE in the generated code.
diff --git a/rtx-funcs.scm b/rtx-funcs.scm
index 6c28735..f16864a 100644
--- a/rtx-funcs.scm
+++ b/rtx-funcs.scm
@@ -1086,6 +1086,13 @@
      COMPARE
      #f
 )
+; Detect NaNs
+(drn (unordered &options &mode s1 s2)
+     BI
+     (OPTIONS ANYNUMMODE RTX RTX) (NA NA MATCHEXPR MATCH2)
+     COMPARE
+     #f
+)
 \f
 ; Set membership.
 ; Useful in ifield assertions.
-- 
2.21.0


  reply	other threads:[~2019-06-01  7:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-01  7:26 [OpenRISC] [PATCH 0/2] CGEN unordered fpu compares + fixes Stafford Horne
2019-06-01  7:26 ` Stafford Horne [this message]
2019-06-01  7:26 ` [OpenRISC] [PATCH 2/2] gen-doc: Updates for latest cpu definitions Stafford Horne
2019-06-12 13:14 ` [OpenRISC] [PATCH 0/2] CGEN unordered fpu compares + fixes Stafford Horne
2019-06-12 14:36   ` Jose E. Marchesi
2019-06-12 15:04   ` Frank Ch. Eigler
2019-06-12 20:53     ` Stafford Horne

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=20190601072629.4070-2-shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=openrisc@lists.librecores.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.