From 58fa21622b01d6064024c92bb09fb60fa5b75977 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Mon, 10 Oct 2022 11:01:48 +0200 Subject: 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. --- gcc/range-op-float.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc/range-op-float.cc') 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 { -- cgit v1.1