From patchwork Wed Nov 9 09:02:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 60257 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A1C038438AB for ; Wed, 9 Nov 2022 09:03:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A1C038438AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667984613; bh=X8CypjryYgIOaa76IihJDCkUfskQmezN6hKnvBPyikQ=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=MhSze1NBnzJmGe42F5IzAzTvVX3I7jx2NUaaPvrM6S0jGqPYo/t5MALF2GjQR+d0f voVVGU4gLv+DihUv8+2xSBgwX3mj4IqBTseq8jGItep5VROgN5NvYmdMlLVUZQuKdJ 1ZuE80XDmlOfq8wlwhV2Cxx3ECeZGgSshNTwRNIo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7BFE03858D20 for ; Wed, 9 Nov 2022 09:02:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7BFE03858D20 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-aJEA3ShZNAqG97-D8ie44Q-1; Wed, 09 Nov 2022 04:02:53 -0500 X-MC-Unique: aJEA3ShZNAqG97-D8ie44Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F8B7185A78B for ; Wed, 9 Nov 2022 09:02:53 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC3C640C6EC3; Wed, 9 Nov 2022 09:02:52 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 2A992o7O1036240 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 9 Nov 2022 10:02:50 +0100 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 2A992oOv1036239; Wed, 9 Nov 2022 10:02:50 +0100 To: GCC patches Cc: Jakub Jelinek , Andrew MacLeod , Aldy Hernandez Subject: [COMMITTED] Implement op[12]_range operators for PLUS_EXPR and MINUS_EXPR. Date: Wed, 9 Nov 2022 10:02:46 +0100 Message-Id: <20221109090246.1036213-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" We can implement the op[12]_range entries for plus and minus in terms of each other. These are adapted from the integer versions. gcc/ChangeLog: * range-op-float.cc (foperator_plus::op1_range): New. (foperator_plus::op2_range): New. (foperator_minus::op1_range): New. (foperator_minus::op2_range): New. --- gcc/range-op-float.cc | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index d52e971f84e..44db81c1c1e 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1862,6 +1862,29 @@ foperator_unordered_equal::op1_range (frange &r, tree type, class foperator_plus : public range_operator_float { + using range_operator_float::op1_range; + using range_operator_float::op2_range; +public: + virtual bool op1_range (frange &r, tree type, + const frange &lhs, + const frange &op2, + relation_trio = TRIO_VARYING) const final override + { + if (lhs.undefined_p ()) + return false; + range_op_handler minus (MINUS_EXPR, type); + if (!minus) + return false; + return minus.fold_range (r, type, lhs, op2); + } + virtual bool op2_range (frange &r, tree type, + const frange &lhs, + const frange &op1, + relation_trio = TRIO_VARYING) const final override + { + return op1_range (r, type, lhs, op1); + } +private: void rv_fold (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, bool &maybe_nan, tree type, const REAL_VALUE_TYPE &lh_lb, @@ -1886,6 +1909,28 @@ class foperator_plus : public range_operator_float class foperator_minus : public range_operator_float { + using range_operator_float::op1_range; + using range_operator_float::op2_range; +public: + virtual bool op1_range (frange &r, tree type, + const frange &lhs, + const frange &op2, + relation_trio = TRIO_VARYING) const final override + { + if (lhs.undefined_p ()) + return false; + return fop_plus.fold_range (r, type, lhs, op2); + } + virtual bool op2_range (frange &r, tree type, + const frange &lhs, + const frange &op1, + relation_trio = TRIO_VARYING) const final override + { + if (lhs.undefined_p ()) + return false; + return fold_range (r, type, op1, lhs); + } +private: void rv_fold (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, bool &maybe_nan, tree type, const REAL_VALUE_TYPE &lh_lb,