From patchwork Thu Sep 1 18:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1673119 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=tFefUFR6; 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 4MJTWY6PZ5z1yn9 for ; Fri, 2 Sep 2022 04:06:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B87AE3858C00 for ; Thu, 1 Sep 2022 18:06:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B87AE3858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662055589; bh=uqM0t8W8edKTKrDfhHZxWXwkOuIewexTkdn2Iq0PQhQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tFefUFR6Q0OZvz8Gz4uv0ws6xSyLa/7aHI734bbiu1EniPdVeIJYuDQHRmhPnByac eQV3KYEVerpyixvQ0wv7cvXXCalFU79G3SdNdGtkRQHMJSc3MgFxsqndvE79lCUFMB Xu8zTxL2lwSxupE7ULu1GpD7lT8KL83YNmzU1xDQ= 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 29D203858D1E for ; Thu, 1 Sep 2022 18:06:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29D203858D1E 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-177-Q0cF_GTlNFOk-eZFsqltWA-1; Thu, 01 Sep 2022 14:06:00 -0400 X-MC-Unique: Q0cF_GTlNFOk-eZFsqltWA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A43421C006B9 for ; Thu, 1 Sep 2022 18:05:58 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 444BE1415125; Thu, 1 Sep 2022 18:05:58 +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 281I5tHF2867014 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 1 Sep 2022 20:05:56 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 281I5tvO2867013; Thu, 1 Sep 2022 20:05:55 +0200 To: GCC patches Subject: [COMMITTED] Convert ranger uses of real_inf to dconst[n]inf. Date: Thu, 1 Sep 2022 20:05:47 +0200 Message-Id: <20220901180547.2866973-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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" gcc/ChangeLog: * range-op-float.cc (build_le): Convert to dconst*inf. (build_ge): Same. * value-range.cc (frange::set_signbit): Same. (frange::normalize_kind): Same. (range_tests_floats): Same. * value-range.h (vrp_val_max): Same. (vrp_val_min): Same. (frange::set_varying): Same. --- gcc/range-op-float.cc | 16 ++++++---------- gcc/value-range.cc | 23 ++++++++--------------- gcc/value-range.h | 16 ++++------------ 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 2f1af4055c3..7301e5a060b 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -232,17 +232,15 @@ frange_drop_ninf (frange &r, tree type) r.intersect (tmp); } -// (X <= VAL) produces the range of [MIN, VAL]. +// (X <= VAL) produces the range of [-INF, VAL]. static void build_le (frange &r, tree type, const REAL_VALUE_TYPE &val) { - REAL_VALUE_TYPE min; - real_inf (&min, 1); - r.set (type, min, val); + r.set (type, dconstninf, val); } -// (X < VAL) produces the range of [MIN, VAL). +// (X < VAL) produces the range of [-INF, VAL). static void build_lt (frange &r, tree type, const REAL_VALUE_TYPE &val) @@ -251,17 +249,15 @@ build_lt (frange &r, tree type, const REAL_VALUE_TYPE &val) build_le (r, type, val); } -// (X >= VAL) produces the range of [VAL, MAX]. +// (X >= VAL) produces the range of [VAL, +INF]. static void build_ge (frange &r, tree type, const REAL_VALUE_TYPE &val) { - REAL_VALUE_TYPE max; - real_inf (&max, 0); - r.set (type, val, max); + r.set (type, val, dconstinf); } -// (X > VAL) produces the range of (VAL, MAX]. +// (X > VAL) produces the range of (VAL, +INF]. static void build_gt (frange &r, tree type, const REAL_VALUE_TYPE &val) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 71581b2c54d..6fd6e3b745c 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -320,18 +320,14 @@ frange::set_signbit (fp_prop::kind k) if (k == fp_prop::YES) { // Crop the range to [-INF, 0]. - REAL_VALUE_TYPE min; - real_inf (&min, 1); - frange crop (m_type, min, dconst0); + frange crop (m_type, dconstninf, dconst0); intersect (crop); m_props.set_signbit (fp_prop::YES); } else if (k == fp_prop::NO) { // Crop the range to [0, +INF]. - REAL_VALUE_TYPE max; - real_inf (&max, 0); - frange crop (m_type, dconst0, max); + frange crop (m_type, dconst0, dconstinf); intersect (crop); m_props.set_signbit (fp_prop::NO); } @@ -440,8 +436,8 @@ frange::normalize_kind () if (!m_props.varying_p ()) { m_kind = VR_RANGE; - real_inf (&m_min, 1); - real_inf (&m_max, 0); + m_min = dconstninf; + m_max = dconstinf; return true; } } @@ -3785,12 +3781,9 @@ range_tests_floats () ASSERT_FALSE (r0.varying_p ()); // The endpoints of a VARYING are +-INF. - REAL_VALUE_TYPE inf, ninf; - real_inf (&inf, 0); - real_inf (&ninf, 1); r0.set_varying (float_type_node); - ASSERT_TRUE (real_identical (&r0.lower_bound (), &ninf)); - ASSERT_TRUE (real_identical (&r0.upper_bound (), &inf)); + ASSERT_TRUE (real_identical (&r0.lower_bound (), &dconstninf)); + ASSERT_TRUE (real_identical (&r0.upper_bound (), &dconstinf)); // The maximum representable range for a type is still a subset of VARYING. REAL_VALUE_TYPE q, r; @@ -3800,9 +3793,9 @@ range_tests_floats () // r0 is not a varying, because it does not include -INF/+INF. ASSERT_FALSE (r0.varying_p ()); // The upper bound of r0 must be less than +INF. - ASSERT_TRUE (real_less (&r0.upper_bound (), &inf)); + ASSERT_TRUE (real_less (&r0.upper_bound (), &dconstinf)); // The lower bound of r0 must be greater than -INF. - ASSERT_TRUE (real_less (&ninf, &r0.lower_bound ())); + ASSERT_TRUE (real_less (&dconstninf, &r0.lower_bound ())); // For most architectures, where float and double are different // sizes, having the same endpoints does not necessarily mean the diff --git a/gcc/value-range.h b/gcc/value-range.h index 3767bd17314..bc00f3d5b08 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -1050,11 +1050,7 @@ vrp_val_max (const_tree type) return wide_int_to_tree (const_cast (type), max); } if (frange::supports_p (type)) - { - REAL_VALUE_TYPE real; - real_inf (&real); - return build_real (const_cast (type), real); - } + return build_real (const_cast (type), dconstinf); return NULL_TREE; } @@ -1068,11 +1064,7 @@ vrp_val_min (const_tree type) if (POINTER_TYPE_P (type)) return build_zero_cst (const_cast (type)); if (frange::supports_p (type)) - { - REAL_VALUE_TYPE ninf; - real_inf (&ninf, 1); - return build_real (const_cast (type), ninf); - } + return build_real (const_cast (type), dconstninf); return NULL_TREE; } @@ -1145,8 +1137,8 @@ frange::set_varying (tree type) { m_kind = VR_VARYING; m_type = type; - real_inf (&m_min, 1); - real_inf (&m_max, 0); + m_min = dconstninf; + m_max = dconstinf; m_props.set_varying (); }