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: 902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp369051wro; Thu, 1 Sep 2022 11:06:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5LRie2DjBD4y3hlWFdZvQPRehnjnT4AiJKzRKmdgrYO/7JRNY3kT7Fr+2Rm0SPVPQHh1NA X-Received: by 2002:a17:907:80d:b0:73d:a576:dfbd with SMTP id wv13-20020a170907080d00b0073da576dfbdmr24327105ejb.402.1662055615197; Thu, 01 Sep 2022 11:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662055615; cv=none; d=google.com; s=arc-20160816; b=BZAaNFDq9CWaoUn0ggs5l8hlOHzWjD+8GzcxxApkgpY/js8/jQK1SrH/LB4et0xEqd q5yIk5Rxt5jfjeqCrougGfFIz+PorG7rNRFxxPHu1es7xwhJ8z1/l9qII14RgeejR8ea pm0iFxEYpLuq+rTtiMCbdrHG2t4AoRqyhlYxYoiBW19wyxG0D5BcYnzpt+Gl6yVqyeHt lVi/gM3xfPdnfOiRhV5Fu3NIBWuYq9qNziuCSkwEf1YBDY6ihNr9hGjer6R1Miy6SGui xwfGpD0Rr7e5zGjxfuct4TB6TGUGaHumQtM1tVzcp7w78NT4FQ9yQyoYTA0HyhvxKmH9 SU6A== 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=uqM0t8W8edKTKrDfhHZxWXwkOuIewexTkdn2Iq0PQhQ=; b=zo+UogECoTc2+dnwJluKTBEBiMI19Ksy7oFpqckQtpqgIIQttdKukc9d56/BO5UtJg 61CA+Je9gQZE8bGD4J1xE9+/ak1dwvbkSh6XLM2az0BIohRzA39//H1JUuIIh2M2+dmO je4PbWJc8BJ6WrmkfZU8F1H5OcT8nUTsvJPtMwcIULxkxfP+EQtht7pwJId87oiKRiOs 16GxbjIWMkU5gLecJeEbLBKobopXAteYh7Hz/2fsjPYsGscEwfr6eK8uJyk5UDHfzzyd oQUDlJytXn/6xLM3MgudokCOG/q8UmjH+1WdvfyUbIC7/OZgy/D+U+toKljphY0MDAbI 19Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kx9ABAYF; 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 sa18-20020a1709076d1200b0073daf6b44a5si13168244ejc.775.2022.09.01.11.06.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 11:06:55 -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=kx9ABAYF; 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 CAAB93858C39 for ; Thu, 1 Sep 2022 18:06:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAAB93858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662055612; bh=uqM0t8W8edKTKrDfhHZxWXwkOuIewexTkdn2Iq0PQhQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kx9ABAYFsn35tiE2S+lJPOaSsKdk9klRUwBjXPqXAEY4uqIRgXO9TrhM24vkwiKJ7 exUsEHckjKNrCgfKjAx8Hq+JGBhi3R3mayqVHM9slIEnWwDwJ57hp1nC3PLxw3eMn2 6EmbMqLi3j/1taD6uwknrtE/paqJtsnb0jsGmbZI= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742791628649164115?= X-GMAIL-MSGID: =?utf-8?q?1742791628649164115?= 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 (); }