From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id D988C384D17A; Thu, 20 Oct 2022 19:42:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D988C384D17A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666294955; bh=5Sd76jwfS6JrrTp6RjRM4hg219DiIl5TwCo516xHF3c=; h=From:To:Subject:Date:From; b=hBRpWkGdvElQsFLfFUfyVST9AD1XffxjBytUnW1bjOzmzWfwi3pKiLyv9UAYvLQpz tHGVAwnpmaYoVV+63AqWQUqS0Vu6GuUojHTD1PnjYBtCXT6MKjVOjuB32JN9XC9r91 IenDgX+SwSxkyn+aX7BQzV+ciFWy248d+subMpd4= 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-3419] Add op[12]_range for UNORDERED_LT entries in range-op. X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: ecaa9ca6a8bce7d3aec8b7486f5252f82735bdb0 X-Git-Newrev: 2e158eae2a9a8e8d57930b1c7355a5e9661932a4 Message-Id: <20221020194235.D988C384D17A@sourceware.org> Date: Thu, 20 Oct 2022 19:42:35 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2e158eae2a9a8e8d57930b1c7355a5e9661932a4 commit r13-3419-g2e158eae2a9a8e8d57930b1c7355a5e9661932a4 Author: Aldy Hernandez Date: Wed Oct 19 17:06:41 2022 +0200 Add op[12]_range for UNORDERED_LT entries in range-op. gcc/ChangeLog: * range-op-float.cc (foperator_unordered_lt::op1_range): New. (foperator_unordered_lt::op2_range): New. Diff: --- gcc/range-op-float.cc | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 0cb07c2ec29..8777bc70d71 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1280,6 +1280,8 @@ foperator_abs::op1_range (frange &r, tree type, class foperator_unordered_lt : public range_operator_float { using range_operator_float::fold_range; + using range_operator_float::op1_range; + using range_operator_float::op2_range; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -1302,8 +1304,70 @@ public: return true; } } + bool op1_range (frange &r, tree type, + const irange &lhs, + const frange &op2, + relation_trio trio) const final override; + bool op2_range (frange &r, tree type, + const irange &lhs, + const frange &op1, + relation_trio trio) const final override; } fop_unordered_lt; +bool +foperator_unordered_lt::op1_range (frange &r, tree type, + const irange &lhs, + const frange &op2, + relation_trio) const +{ + switch (get_bool_state (r, lhs, type)) + { + case BRS_TRUE: + build_lt (r, type, op2); + break; + + case BRS_FALSE: + // A false UNORDERED_LT means both operands are !NAN, so it's + // impossible for op2 to be a NAN. + if (op2.known_isnan ()) + r.set_undefined (); + else if (build_ge (r, type, op2)) + r.clear_nan (); + break; + + default: + break; + } + return true; +} + +bool +foperator_unordered_lt::op2_range (frange &r, tree type, + const irange &lhs, + const frange &op1, + relation_trio) const +{ + switch (get_bool_state (r, lhs, type)) + { + case BRS_TRUE: + build_gt (r, type, op1); + break; + + case BRS_FALSE: + // A false UNORDERED_LT means both operands are !NAN, so it's + // impossible for op1 to be a NAN. + if (op1.known_isnan ()) + r.set_undefined (); + else if (build_le (r, type, op1)) + r.clear_nan (); + break; + + default: + break; + } + return true; +} + class foperator_unordered_le : public range_operator_float { using range_operator_float::fold_range;