From patchwork Thu Sep 1 18:08:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp370001wro; Thu, 1 Sep 2022 11:09:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Q3bI+EuHvlABEnDRzUkQUpuv/3uaZJjTTQNxM7tk/Wh8WWzd67T8FaJBZRIU4taBS4bxD X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr25425818ejc.676.1662055748066; Thu, 01 Sep 2022 11:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662055748; cv=none; d=google.com; s=arc-20160816; b=g7XVZnDrDTmefeZYOi/K7Rkiz1MLLfxH/riKrmiu0tpPT74TIzWQTZVu9tx1Rn8bNz H5jksW9fyvTIushkKBALmMB4xYaZaOtyIBicJzqykusHUI8OFsPKwq+D2j2xArLplv/x Cg04yDY/P8KcMeIHJz9dsGBASDVY8TU3zqNCO61lB4Fko3dQOYFyT87tn70b0S5Cfokb X7FWVV8ZnO2nR8El120sBLLVcsqPfxgU76D6+iVw+vk8QEWPxfn29FDBPViN4oeHtx2g tRyFossXiVBSctoRis7aPUTYRXlAxggGF+BRDf6ONkNxLz2aTHnrzsMDSo78DRrLyqlq UyXw== 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=YHV9q2ym55BFBEiHYAAQbWcUUth3rQs3ZeXGGlvGHmc=; b=Y+vtDcEsGu7bKRWCb0JGDKeEZ2y3U+ogXOGPn/d+HGRrgUCgfc5kLv/DBb2dQ+cVGx lJsjpNEQU083SGc8shHVYsmBEiVptF3ABA7btgJFuocoZ4BYW50OrrEd8fLQELMycrQV Tp5tzQXg026Svd2AYTJ0tdkaifyGLObhP0WfshkxY93opvSGlDzXAAp8pueGYYvgjO8Q PBZ56GGBD+TqoAGKKy/o7NWrju04b/mb69HpImPX1QU2xw8krcOcufvoRU/fMGmjFs3v 7IHY3NyfnFp/Bn55H1BFHQ6sHmpUqCR9gtlaLjTcL1X8lUeHFYvloCaTwRbgxPQhWvj4 kHRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=reEInayg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ho7-20020a1709070e8700b0073156b6fe1csi17388906ejc.799.2022.09.01.11.09.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 11:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=reEInayg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 C9A47385840F for ; Thu, 1 Sep 2022 18:09:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9A47385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662055746; bh=YHV9q2ym55BFBEiHYAAQbWcUUth3rQs3ZeXGGlvGHmc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=reEInaygPap2VuXJH9K13viA4079HfeScrvxlYYssowRiQK6trN+rAdUUpE66p12X neJ1Yye/sh9y6bzSU3ofNoFBdmUt2s781JBYgTZH4NfQivqEIzuB3fAtJ4flyv/16S zdVo5OCsPAA+7Gm6GmI2S4ELXAfODDjW12EcSw/o= 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 006C43858D1E for ; Thu, 1 Sep 2022 18:08:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 006C43858D1E 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-191-oreSKeLGMuCOLErfEbg9iQ-1; Thu, 01 Sep 2022 14:08:19 -0400 X-MC-Unique: oreSKeLGMuCOLErfEbg9iQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAF5E8039BF for ; Thu, 1 Sep 2022 18:08:18 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8505E1121314; Thu, 1 Sep 2022 18:08:18 +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 281I8FF82867529 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 1 Sep 2022 20:08:15 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 281I8F2L2867528; Thu, 1 Sep 2022 20:08:15 +0200 To: GCC patches Subject: [PATCH] Convert rest of compiler to dconst[n]inf. Date: Thu, 1 Sep 2022 20:08:09 +0200 Message-Id: <20220901180809.2867483-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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?1742791767704618679?= X-GMAIL-MSGID: =?utf-8?q?1742791767704618679?= This is kinda obvious. OK? gcc/ChangeLog: * builtins.cc (fold_builtin_inf): Convert use of real_info to dconstinf. (fold_builtin_fpclassify): Same. * fold-const-call.cc (fold_const_call_cc): Same. * match.pd: Same. * omp-low.cc (omp_reduction_init_op): Same. * realmpfr.cc (real_from_mpfr): Same. * tree.cc (build_complex_inf): Same. --- gcc/builtins.cc | 8 ++------ gcc/fold-const-call.cc | 2 +- gcc/match.pd | 2 +- gcc/omp-low.cc | 9 +++------ gcc/realmpfr.cc | 2 +- gcc/tree.cc | 5 ++--- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/gcc/builtins.cc b/gcc/builtins.cc index f1f7c0ce337..5f319b28030 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -8696,8 +8696,6 @@ fold_builtin_strlen (location_t loc, tree expr, tree type, tree arg) static tree fold_builtin_inf (location_t loc, tree type, int warn) { - REAL_VALUE_TYPE real; - /* __builtin_inff is intended to be usable to define INFINITY on all targets. If an infinity is not available, INFINITY expands "to a positive constant of type float that overflows at translation @@ -8708,8 +8706,7 @@ fold_builtin_inf (location_t loc, tree type, int warn) if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn) pedwarn (loc, 0, "target format does not support infinity"); - real_inf (&real); - return build_real (type, real); + return build_real (type, dconstinf); } /* Fold function call to builtin sincos, sincosf, or sincosl. Return @@ -9336,9 +9333,8 @@ fold_builtin_fpclassify (location_t loc, tree *args, int nargs) if (tree_expr_maybe_infinite_p (arg)) { - real_inf (&r); tmp = fold_build2_loc (loc, EQ_EXPR, integer_type_node, arg, - build_real (type, r)); + build_real (type, dconstinf)); res = fold_build3_loc (loc, COND_EXPR, integer_type_node, tmp, fp_infinite, res); } diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc index c18256825af..72953875414 100644 --- a/gcc/fold-const-call.cc +++ b/gcc/fold-const-call.cc @@ -1116,7 +1116,7 @@ fold_const_call_cc (real_value *result_real, real_value *result_imag, CASE_CFN_CPROJ: if (real_isinf (arg_real) || real_isinf (arg_imag)) { - real_inf (result_real); + *result_real = dconstinf; *result_imag = dconst0; result_imag->sign = arg_imag->sign; } diff --git a/gcc/match.pd b/gcc/match.pd index f5fec634279..17318f523fb 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -5300,7 +5300,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) if (cmp == LT_EXPR || cmp == GE_EXPR) tow = dconst0; else - real_inf (&tow); + tow = dconstinf; real_nextafter (&c2alt, fmt, &c2, &tow); real_convert (&c2alt, fmt, &c2alt); if (REAL_VALUE_ISINF (c2alt)) diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index f54dea923bf..e9e4bd05d72 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -4524,12 +4524,9 @@ omp_reduction_init_op (location_t loc, enum tree_code op, tree type) case MAX_EXPR: if (SCALAR_FLOAT_TYPE_P (type)) { - REAL_VALUE_TYPE max, min; + REAL_VALUE_TYPE min; if (HONOR_INFINITIES (type)) - { - real_inf (&max); - real_arithmetic (&min, NEGATE_EXPR, &max, NULL); - } + real_arithmetic (&min, NEGATE_EXPR, &dconstinf, NULL); else real_maxval (&min, 1, TYPE_MODE (type)); return build_real (type, min); @@ -4551,7 +4548,7 @@ omp_reduction_init_op (location_t loc, enum tree_code op, tree type) { REAL_VALUE_TYPE max; if (HONOR_INFINITIES (type)) - real_inf (&max); + max = dconstinf; else real_maxval (&max, 0, TYPE_MODE (type)); return build_real (type, max); diff --git a/gcc/realmpfr.cc b/gcc/realmpfr.cc index 54d097f5965..f7f096330ce 100644 --- a/gcc/realmpfr.cc +++ b/gcc/realmpfr.cc @@ -68,7 +68,7 @@ real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, const real_format *format, /* Take care of Infinity and NaN. */ if (mpfr_inf_p (m)) { - real_inf (r); + *r = dconstinf; if (mpfr_sgn (m) < 0) *r = real_value_negate (r); return; diff --git a/gcc/tree.cc b/gcc/tree.cc index 007c9325b17..0179c0fdc9d 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -2535,11 +2535,10 @@ build_complex (tree type, tree real, tree imag) tree build_complex_inf (tree type, bool neg) { - REAL_VALUE_TYPE rinf, rzero = dconst0; + REAL_VALUE_TYPE rzero = dconst0; - real_inf (&rinf); rzero.sign = neg; - return build_complex (type, build_real (TREE_TYPE (type), rinf), + return build_complex (type, build_real (TREE_TYPE (type), dconstinf), build_real (TREE_TYPE (type), rzero)); }