From patchwork Thu Sep 1 14:13:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 57248 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1707E385840A for ; Thu, 1 Sep 2022 14:14:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1707E385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662041650; bh=wbS6RXAiA8J2tQKoZslw6FcdUBVt4WeDGm9V9Z6hhew=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JZVQrTrVUHpUntxO2UhzBS4VcvO/sUnpHwZzNtY0OzSJ7MB1RQB1dsqHcEW9a9o7f BNCSwSfuZale6qyZkmJzcdYS9Z9bTHj+30YKK2QVoMOtVj0zA+wFJjTKGulNfjEXbB eaV378Z+QwsQEeP8PjVUu47PozdKFdY+kGAoBq6I= 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 AAC963858D1E for ; Thu, 1 Sep 2022 14:13:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AAC963858D1E 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-635-wMUgg5cJNQOA6pZoE8JJ9w-1; Thu, 01 Sep 2022 10:13:38 -0400 X-MC-Unique: wMUgg5cJNQOA6pZoE8JJ9w-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 DC654185A7BA for ; Thu, 1 Sep 2022 14:13:37 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 934B51415137; Thu, 1 Sep 2022 14:13:37 +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 281EDUJ82771289 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 1 Sep 2022 16:13:30 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 281EDT1F2771285; Thu, 1 Sep 2022 16:13:29 +0200 To: GCC patches Subject: [PATCH] Add global REAL_VALUE_TYPE infinities to real.*. Date: Thu, 1 Sep 2022 16:13:24 +0200 Message-Id: <20220901141324.2771267-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=-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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" We're starting to abuse the infinity endpoints in the frange code and the associated range operators. Building infinities are rather cheap, and we could even inline them, but I think it's best to just not recalculate them all the time. I see about 20 uses of real_inf in the source code, not including the backends. And I'm about to add more :). OK pending tests? gcc/ChangeLog: * emit-rtl.cc (init_emit_once): Initialize dconstinf and dconstninf. * real.h: Add dconstinf and dconstninf. --- gcc/emit-rtl.cc | 5 +++++ gcc/real.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index 3929ee08986..f25fb70ab97 100644 --- a/gcc/emit-rtl.cc +++ b/gcc/emit-rtl.cc @@ -107,6 +107,8 @@ REAL_VALUE_TYPE dconst1; REAL_VALUE_TYPE dconst2; REAL_VALUE_TYPE dconstm1; REAL_VALUE_TYPE dconsthalf; +REAL_VALUE_TYPE dconstinf; +REAL_VALUE_TYPE dconstninf; /* Record fixed-point constant 0 and 1. */ FIXED_VALUE_TYPE fconst0[MAX_FCONST0]; @@ -6210,6 +6212,9 @@ init_emit_once (void) dconsthalf = dconst1; SET_REAL_EXP (&dconsthalf, REAL_EXP (&dconsthalf) - 1); + real_inf (&dconstinf); + real_inf (&dconstninf, true); + for (i = 0; i < 3; i++) { const REAL_VALUE_TYPE *const r = diff --git a/gcc/real.h b/gcc/real.h index ec78e8a8932..2f490ef9b72 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -462,6 +462,8 @@ extern REAL_VALUE_TYPE dconst1; extern REAL_VALUE_TYPE dconst2; extern REAL_VALUE_TYPE dconstm1; extern REAL_VALUE_TYPE dconsthalf; +extern REAL_VALUE_TYPE dconstinf; +extern REAL_VALUE_TYPE dconstninf; #define dconst_e() (*dconst_e_ptr ()) #define dconst_third() (*dconst_third_ptr ())