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: 1673120 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=8.43.85.97; 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=wqF8zGv0; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4MJTZ63KR3z1yn9 for ; Fri, 2 Sep 2022 04:08:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB0343858407 for ; Thu, 1 Sep 2022 18:08:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB0343858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662055723; bh=YHV9q2ym55BFBEiHYAAQbWcUUth3rQs3ZeXGGlvGHmc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wqF8zGv0LN92gakM0UsZDechp6z+Fsx/fqH2gXimqaB0Yhydf94wbfkdgX5vymSNn CzXt4dl8+qcSNjWRipk10DiuOz6NALq8hBqAPNOnIFjHF5U2ZbA5vsebMAgJ4yMvXp +vRqJCSq+2iz+w9k6KJXDPxHdyid+7mGgnlNimes= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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)); }