public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3194] x UNORD x should set NAN on the TRUE side (and !NAN on the FALSE side).
@ 2022-10-10 12:50 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-10 12:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:58fa21622b01d6064024c92bb09fb60fa5b75977

commit r13-3194-g58fa21622b01d6064024c92bb09fb60fa5b75977
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Oct 10 11:01:48 2022 +0200

    x UNORD x should set NAN on the TRUE side (and !NAN on the FALSE side).
    
    gcc/ChangeLog:
    
            * range-op-float.cc (foperator_unordered::op1_range): Set NAN when
            operands are equal and result is TRUE.

Diff:
---
 gcc/range-op-float.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 68578aa6fe7..91833d3f855 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -1026,23 +1026,27 @@ bool
 foperator_unordered::op1_range (frange &r, tree type,
 				const irange &lhs,
 				const frange &op2,
-				relation_kind) const
+				relation_kind rel) const
 {
   switch (get_bool_state (r, lhs, type))
     {
     case BRS_TRUE:
+      if (rel == VREL_EQ)
+	r.set_nan (type);
       // Since at least one operand must be NAN, if one of them is
       // not, the other must be.
-      if (!op2.maybe_isnan ())
+      else if (!op2.maybe_isnan ())
 	r.set_nan (type);
       else
 	r.set_varying (type);
       break;
 
     case BRS_FALSE:
+      if (rel == VREL_EQ)
+	r.clear_nan ();
       // A false UNORDERED means both operands are !NAN, so it's
       // impossible for op2 to be a NAN.
-      if (op2.known_isnan ())
+      else if (op2.known_isnan ())
 	r.set_undefined ();
       else
 	{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-10 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 12:50 [gcc r13-3194] x UNORD x should set NAN on the TRUE side (and !NAN on the FALSE side) Aldy Hernandez

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).