From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id F1CF8389EC62; Mon, 10 Oct 2022 12:50:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1CF8389EC62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665406248; bh=IUlF7D3i2yrem4dAg8E2P7iGdE2RTHFeCnt1akkPcoE=; h=From:To:Subject:Date:From; b=Gcn+uJNUFtfLE9rtG2Xp87kvGf/ts2EIErulVQJ4HRuiP2GYDqdkBz9Pdrysn2zMn pUYQnYxB4iSsCSbt00SZpfh1ywfsV8llKB9+aorbEpml4+PI3C1ZwT/L6221TOFSvy D2VmKBa/0HGhJ0IBqXaPk7berQX7eGukhRMYRWpE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3194] x UNORD x should set NAN on the TRUE side (and !NAN on the FALSE side). X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: 8b6bcedc88d54415cbc018b3f7fc2bc20dcd4800 X-Git-Newrev: 58fa21622b01d6064024c92bb09fb60fa5b75977 Message-Id: <20221010125048.F1CF8389EC62@sourceware.org> Date: Mon, 10 Oct 2022 12:50:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:58fa21622b01d6064024c92bb09fb60fa5b75977 commit r13-3194-g58fa21622b01d6064024c92bb09fb60fa5b75977 Author: Aldy Hernandez 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 {