diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-10-10 11:01:48 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-10-10 14:50:16 +0200 |
commit | 58fa21622b01d6064024c92bb09fb60fa5b75977 (patch) | |
tree | 65063d65dfd9df9fcd1a4109e48b5cc9ec675369 | |
parent | 8b6bcedc88d54415cbc018b3f7fc2bc20dcd4800 (diff) | |
download | gcc-58fa21622b01d6064024c92bb09fb60fa5b75977.zip gcc-58fa21622b01d6064024c92bb09fb60fa5b75977.tar.gz gcc-58fa21622b01d6064024c92bb09fb60fa5b75977.tar.bz2 |
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.
-rw-r--r-- | gcc/range-op-float.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 68578aa..91833d3 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 { |