From patchwork Thu Oct 13 12:17:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1689490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=hjlF1xXU; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mp7nj0PZ2z23k3 for ; Thu, 13 Oct 2022 23:17:43 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E5CE73858C56 for ; Thu, 13 Oct 2022 12:17:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5CE73858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665663460; bh=ys1HV+d0qIeQ/LIBtLPvA22HJiEw2I0vtzGDkE6o7/M=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=hjlF1xXU4tmZ7PaKO0a6LD3d9ebvYa3b0DJa2mGSC4C+bo5IMSvSc4Rg1AIRF9+nC PknzEqf9lmqQVtzXvJRjP/5TsrlZPsHB9NcssNKxYj5YiY5Onb6JFjcbx5F3Mbnmcz 5vOmKbH9pqrN16YwvlHGpt9jqZ2LGYYgV9DuLDMs= 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 22F703858C55 for ; Thu, 13 Oct 2022 12:17:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 22F703858C55 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-19-q6EDmgGkPkGHTM1FUGJBpw-1; Thu, 13 Oct 2022 08:17:18 -0400 X-MC-Unique: q6EDmgGkPkGHTM1FUGJBpw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D3AC3C0D86A for ; Thu, 13 Oct 2022 12:17:13 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.80]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E3A9492B05; Thu, 13 Oct 2022 12:17:06 +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 29DCH3Zs473617 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 13 Oct 2022 14:17:03 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29DCH3Jf473616; Thu, 13 Oct 2022 14:17:03 +0200 To: GCC patches Subject: [COMMITTED] Add op1_op2_relation for float operands. Date: Thu, 13 Oct 2022 14:17:01 +0200 Message-Id: <20221013121701.473585-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" op1_op2_relation can be called for relops (bool = a < b) as well as regular binary operators (z = a + b). This patch adds the overloaded method for floating point results. gcc/ChangeLog: * range-op-float.cc (range_operator_float::op1_op2_relation): New. (class foperator_equal): Add using. (class foperator_not_equal): Same. (class foperator_lt): Same. (class foperator_le): Same. (class foperator_gt): Same. (class foperator_ge): Same. * range-op.cc (range_op_handler::op1_op2_relation): New. * range-op.h (range_operator_float::op1_op2_relation): New. --- gcc/range-op-float.cc | 12 ++++++++++++ gcc/range-op.cc | 4 +++- gcc/range-op.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 229b9d23351..23e0f5ef4e2 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -160,6 +160,12 @@ range_operator_float::op1_op2_relation (const irange &lhs ATTRIBUTE_UNUSED) cons return VREL_VARYING; } +relation_kind +range_operator_float::op1_op2_relation (const frange &lhs ATTRIBUTE_UNUSED) const +{ + return VREL_VARYING; +} + // Return TRUE if OP1 is known to be free of NANs. static inline bool @@ -338,6 +344,7 @@ class foperator_equal : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -444,6 +451,7 @@ class foperator_not_equal : public range_operator_float { using range_operator_float::fold_range; using range_operator_float::op1_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -545,6 +553,7 @@ class foperator_lt : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -660,6 +669,7 @@ class foperator_le : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -767,6 +777,7 @@ class foperator_gt : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, @@ -882,6 +893,7 @@ class foperator_ge : public range_operator_float using range_operator_float::fold_range; using range_operator_float::op1_range; using range_operator_float::op2_range; + using range_operator_float::op1_op2_relation; public: bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 16fa1f4f46d..f8255dd10a1 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -4476,7 +4476,9 @@ range_op_handler::op1_op2_relation (const vrange &lhs) const gcc_checking_assert (m_valid); if (m_int) return m_int->op1_op2_relation (as_a (lhs)); - return m_float->op1_op2_relation (as_a (lhs)); + if (is_a (lhs)) + return m_float->op1_op2_relation (as_a (lhs)); + return m_float->op1_op2_relation (as_a (lhs)); } // Cast the range in R to TYPE. diff --git a/gcc/range-op.h b/gcc/range-op.h index b2f063afb07..48adcecc7c6 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -160,6 +160,7 @@ public: const frange &op2, relation_kind = VREL_VARYING) const; virtual relation_kind op1_op2_relation (const irange &lhs) const; + virtual relation_kind op1_op2_relation (const frange &lhs) const; }; class range_op_handler