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: 899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp273842wro; Thu, 1 Sep 2022 07:14:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5B7Ky8/xkNgaC3weNYWuAs6aoTJ3MlZSPHY9DpXst/4R4gcyDoE28n50CjDT2UaNIZaK26 X-Received: by 2002:a17:906:8472:b0:741:5bf7:916d with SMTP id hx18-20020a170906847200b007415bf7916dmr15435554ejc.57.1662041665428; Thu, 01 Sep 2022 07:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662041665; cv=none; d=google.com; s=arc-20160816; b=I4X8mE/bV4vVxpyxRgX3nFBvO5K/Cw/BoW8QmucMyaWHE83RkdhQZIfrK4TP4pYTQb eSN3l1sRHgtVYsEVJSNNejG+jMtT8vYR6jFbHLyl7C7IiRE/QQqhU9DHEgbjt2hEZh4w taPpSmxZ6ulkpX56BBvfeW2P/fawDCGrbfbwE1sBwBLcTWZU8qk6pLoEdETXasvr+THY El7Sg9zOoPglv81acFJO/m5HSmDdgihbQWnMbHuLqt6yBaGLYioZ3OrzhYhLOrleBfPW cpRZ3COJD6xFY8B5JQcc/rNYEsF4cDSP6ZOoRn11c8R80bys4UXXnQFezf74dHR5cJgf 8Vog== 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=wbS6RXAiA8J2tQKoZslw6FcdUBVt4WeDGm9V9Z6hhew=; b=WYDE4j0AX5hzF77pFq+gPIkak3cJE2g6bFropW+E8TWXoydLlAzxMbNx/E1ehHzNlH KsfTQS6y+qlaqOjM2BH6F478FzxnsTLaz3EfpMsjiS0sw52BxeP8Mf2aOUWtcXtZeesI vaYy1YKtzdZ0f89VRSiavVaRKAuKIQzW9EgoJdLW0jNNWirqRGD25+V2ysz9ssVVjxjY LTY82DI/OC5B+Yqj2yFtVaFg+OQa38k9HckRGQl0yKgO8cgmwL9HnW+0nONseUUiyeOC Ec18IzqdQRxeARHb/wD1vy1IfcCDp9DIGvwWW5VViPOpRkp5I2YunPJ6Gsc/JkpWpGny rCyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=W6iko3Re; 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 hg6-20020a1709072cc600b00733b061e7bdsi6490009ejc.637.2022.09.01.07.14.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 07:14:25 -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=W6iko3Re; 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 43F033858C00 for ; Thu, 1 Sep 2022 14:14:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43F033858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662041664; bh=wbS6RXAiA8J2tQKoZslw6FcdUBVt4WeDGm9V9Z6hhew=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W6iko3RepfPCwX3/7lr64rYTYEqpNPN7opkA6ASfqNpqgsTmJp5t6Y9jv/Erf01/k 2QgJxVmPL5VsCDiNWBI4XbmWVh4aesPXsSke/tE7IyK8FbNn0AqRiM6J3QH0kwPG01 QWf6RoE2s5LGApRfLHIyuaYytJpjiITnBOs12snA= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742777001201795691?= X-GMAIL-MSGID: =?utf-8?q?1742777001201795691?= 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 ())