From: Doug Evans <dje@sebabeach.org>
To: cgen@sourceware.org
Subject: [commit] fix nan handling
Date: Wed, 01 Sep 2010 14:14:00 -0000 [thread overview]
Message-ID: <20100830165248.AACF56E3E1@sebabeach.org> (raw)
Hi.
I've committed this.
nan,qnan,snan return a BI mode value, thus using s-unop to generate
them is wrong.
2010-08-30 Doug Evans <dje@sebabeach.org>
* rtl-c.scm (s-float-predop): New function.
(nan, qnan, snan): Call it.
Index: rtl-c.scm
===================================================================
RCS file: /cvs/src/src/cgen/rtl-c.scm,v
retrieving revision 1.31
diff -u -p -r1.31 rtl-c.scm
--- rtl-c.scm 25 Jan 2010 03:50:43 -0000 1.31
+++ rtl-c.scm 30 Aug 2010 16:47:24 -0000
@@ -828,6 +828,27 @@
"))"))))
)
+;; Process fp predicates, e.g. nan, qnan, snan.
+;; SRC-MODE is the mode name of SRC.
+;; The result has mode BI.
+
+(define (s-float-predop estate name src-mode src)
+ (let* ((val (rtl-c-get estate src-mode src))
+ (mode (cx:mode val))
+ (sem-mode (rtx-sem-mode mode)))
+ ;; FIXME: Argument checking.
+
+ (if (not (mode-float? mode))
+ (estate-error estate "non floating-point mode" src-mode))
+
+ (cx:make (mode:lookup 'BI)
+ (string-append "CGEN_CPU_FPU (current_cpu)->ops->"
+ (string-downcase name)
+ (string-downcase (obj:str-name sem-mode))
+ " (CGEN_CPU_FPU (current_cpu), "
+ (cx:c val) ")")))
+)
+
;; Integer mode conversions.
;; MODE is the mode name.
@@ -1749,13 +1770,13 @@
)
(define-fn nan (*estate* options mode s1)
- (s-unop *estate* "NAN" #f mode s1)
+ (s-float-predop *estate* "NAN" mode s1)
)
(define-fn qnan (*estate* options mode s1)
- (s-unop *estate* "QNAN" #f mode s1)
+ (s-float-predop *estate* "QNAN" mode s1)
)
(define-fn snan (*estate* options mode s1)
- (s-unop *estate* "SNAN" #f mode s1)
+ (s-float-predop *estate* "SNAN" mode s1)
)
(define-fn min (*estate* options mode s1 s2)
reply other threads:[~2010-08-30 16:52 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=20100830165248.AACF56E3E1@sebabeach.org \
--to=dje@sebabeach.org \
--cc=cgen@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).