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: 2037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp241158wrs; Thu, 13 Oct 2022 05:18:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4L9vtUnTHqh2JVjQlHcSs5tKfspSsddhC7SfGF96k71CiTY4teQt7QgOnfDGND6Q3pdEoT X-Received: by 2002:a17:906:974f:b0:78e:1031:6b26 with SMTP id o15-20020a170906974f00b0078e10316b26mr2079974ejy.280.1665663485268; Thu, 13 Oct 2022 05:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665663485; cv=none; d=google.com; s=arc-20160816; b=siSZHlIJnT9WRmVwQCUgsOzHS+1c2/fD3YqieoDCD1NX91aABiTaRNwjZ2Knw2Y5Zf V76pEfJ3louVT0eMnY5bRJKcvXkcuqKgd81dRSrJSfJTljjgGdmt1gdlKTTcHLg3blY6 IYseACO+QFvBUW2pblbUdRYBFedbouymW4WIQDVzJXuD9RnBFt6ZsPQzUbptCcNBQmCv wD7evJ0U1epTKQ/kiWQyow02ihmY0+/aidZ0Y0nQu/SwrEaF+ofjN/PrTJkH7yW8c0vb GGsQq/NgFIq2zFP1HtJeFSvVpUEWyA71I1k+llMeVOZbZAR1YcZcfYyn9ZrPehzFCfeL 4u4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ys1HV+d0qIeQ/LIBtLPvA22HJiEw2I0vtzGDkE6o7/M=; b=kt2sl4xk7K7S8Xg2zi/VRDRObMzLTlw90A1HdxUsQOSYGG0yOuiKbveawzh64Z0JtZ U98eebUX+wZh7MC+7ZK4jrarrpJ4+E3CZxOnOIJkCEa8UHN9tGnpoUwil5XC1BBozEAq mOnbyOLIVTUwj6d3Afusx7xcvAsBSn4l1C23z9gsNnqGa44Mna+f4ZiP+83XSXFlFm04 Ndv8W0cXJ69wg3MfJ7KfE5fbIO7FWtmiiYmTt+AZzwHMg4qHQTMNk6ahKb6APUDim+JN mt3HpU/dzPNnj9Mij1W7cL+SFYRoGKs/VmZDhgjZdI1KzYu2UipDvi2KI9LGmvCsuQGW 9hqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=eEDmo6E6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id va10-20020a17090711ca00b00783ac0b4d32si15740085ejb.941.2022.10.13.05.18.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 05:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=eEDmo6E6; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40DA63858022 for ; Thu, 13 Oct 2022 12:18:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40DA63858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665663484; 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=eEDmo6E6b8Il/Do+ZvzVFYtsGFDkxwHNQw57v3kZCGxEZdo3WJdxAD/HmvGGstgUd Qa5uLsddJl3bqaXf3faemxo55rq0GKdLLSyWhfJNVZ9ZsyWXxJtr6kUhwcz/UMsHIO y4artxBtJ79Jj2LwJH+vmWYHJIcddcY0TRSgn88M= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746574754661439327?= X-GMAIL-MSGID: =?utf-8?q?1746574754661439327?= 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