From patchwork Thu Mar 2 10:32:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 63331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4158215wrd; Thu, 2 Mar 2023 02:33:42 -0800 (PST) X-Google-Smtp-Source: AK7set/k4uwvHo+WINU+SfduWL/j+2nWN3VuKnkDFVZW8PQrjAu9TLCCNz//d+RxVK0jp19Oy6nL X-Received: by 2002:aa7:d74c:0:b0:4af:6969:73d4 with SMTP id a12-20020aa7d74c000000b004af696973d4mr9724245eds.30.1677753221988; Thu, 02 Mar 2023 02:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677753221; cv=none; d=google.com; s=arc-20160816; b=nxXGAIfhYjOXxgQ4n7/Zo7riZRjuI5pr+cXWcicv34m5zbIIbhdiINuHG46TsB/YWv +32qRom0+EsbUIyRGrWJO8nAJYvWCP3tzy8ejNpFakSR3AdD4hEQTrm+34idzOOCOU4G oSBPR9sXTL64cEGGa8a9k890dRrGbtw0GS0r7DeW38mpfZNVP5dDGZ3CehE7Uwlja/xu wOAguWnzh/wmKtxa6SuNlntUu/jK9fy4287U99GWhruIQ3V6KG5YbXYCOU/Qwksi7a25 uueD/PW083rNTijLiytCS/Bb9Mgc82QoGtdtNSfbonxwWQcbHE7eXoqWcrFmaLklCiRt yJxg== 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-disposition:in-reply-to:mime-version:references:message-id :subject:cc:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=RpUYGqyFV+ahH+DktiIQ7UlXvhJfogPxdSpfiq/XOTc=; b=WS2BCVQ4dOZrY0I0v96lD/RGtf4HUd4q+GL1gD3XR/nEjJCABuRWUAXSALseQn0Lty Fq8ut3/OWnzTeESBE857UrN2Dyy4Rj2CKv1Pj/JZMcwqPNzP142Oo2U7wOfn8/sMhigx 4cjdcq9k5nV7NU2XlNhUUCifhvHcgalV5Sh7jkfDRxJnd+dch3DTCX7OwjXdCFO6xtti p6uwFY72mM3M4tpVxv9AQEwtFj1jWk+nSAs0Fli0SkwD8xB3tp4ysTovLV3QNyS1sIfp drn3z6Lzz2OP3QlB8y/FnVK9Wb10KYCKygPsz1WKRHd0fbEq8yjFSyN6NBgf8IEbd3e/ 0KoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nH6LF793; 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 a24-20020aa7d758000000b004a986403dc9si6713722eds.593.2023.03.02.02.33.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 02:33:41 -0800 (PST) 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=nH6LF793; 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 C67AB385841E for ; Thu, 2 Mar 2023 10:33:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C67AB385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677753220; bh=RpUYGqyFV+ahH+DktiIQ7UlXvhJfogPxdSpfiq/XOTc=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nH6LF7936Pb2UtJHJmLM5yObkVIEdfUcAG80AURaFJQYh3fscvuLw3mWbZaxpYlSB fMKqCzQUt+ZN4mYckr57BBpn8puF9RV49F1IdGOctQlJgPEjzYBgF4X/Tk4rSAZsJp HMlE3sfiYu1iEJwKkiPz2Q8TOC48Kkvt0h3kLVqs= 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 CDD423858D33 for ; Thu, 2 Mar 2023 10:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDD423858D33 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-357-oJcmTaSpO1aOU178tIgMdg-1; Thu, 02 Mar 2023 05:32:52 -0500 X-MC-Unique: oJcmTaSpO1aOU178tIgMdg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D00941C05EA8; Thu, 2 Mar 2023 10:32:51 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 916EF492C14; Thu, 2 Mar 2023 10:32:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 322AWjYC3819298 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 2 Mar 2023 11:32:45 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 322AWiNp3819297; Thu, 2 Mar 2023 11:32:44 +0100 Date: Thu, 2 Mar 2023 11:32:44 +0100 To: Gerald Pfeifer , Martin =?utf-8?b?TGnFoWth?= Cc: gcc-patches@gcc.gnu.org Subject: [wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard Message-ID: References: <541d2859-4029-3a21-e57e-10a401c5d226@pfeifer.com> MIME-Version: 1.0 In-Reply-To: <541d2859-4029-3a21-e57e-10a401c5d226@pfeifer.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-9.7 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_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek 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?1759251762206933738?= X-GMAIL-MSGID: =?utf-8?q?1759251762206933738?= Hi! On Fri, Feb 10, 2023 at 10:06:03AM +0100, Gerald Pfeifer wrote: > Yes, thank you! Two minor suggestions/questions below: > > > --- a/htdocs/gcc-13/changes.html > > +++ b/htdocs/gcc-13/changes.html > > + -fexcess-precision=fast. The option affects mainly > > Here I'd say "mainly affects". > > > + IA-32/x86-64 where when defaulting to x87 math and in some cases on > > + Motorola 68000 float and double expressions > > + are evaluated in long double precision and S/390, System z, > > + IBM z Systems where float expressions are evaluated in > > + double precision. > > The "where when" part proved a bit tricky for my brain. :-) > > I think it is precise, but am wondering whether > > ...IA-32/x64 using x87 math and in some cases on Motorola 68000, where > float and double expressions are evaluated... > > might work? What do you think? Thanks, committed with those tweaks. Martin would like to see some note in porting_to.html for it too, here is my attempt to do so: Jakub diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html index 9a9a3147..5cbeefb6 100644 --- a/htdocs/gcc-13/porting_to.html +++ b/htdocs/gcc-13/porting_to.html @@ -120,5 +120,29 @@ the operand as an lvalue.
} +

Excess precision changes

+

GCC 13 implements in C++ excess precision support +which has been implemented just in the C front-end before. The new behavior is +enabled by default in -std=c++NN modes and when +FLT_EVAL_METHOD is 1 or 2 affects behavior of floating point +constants and expressions. E.g. for FLT_EVAL_METHOD equal +to 2 on ia32: + +


+#include 
+void foo (void) { if (1.1f + 3.3f != 1.1L + 3.3L) abort (); }
+void bar (void) { double d = 4.2; if (d == 4.2) abort (); }
+
+ +will not abort with standard excess precision, because constants and expressions +in float or double are evaluated in precision of +long double and demoted only on casts or assignments, but will +abort with fast excess precision, where whether something is evaluated in +precision of long double or not depends on what evaluations are +done in the i387 floating point stack or are spilled from it. + +The -fexcess-precision=fast option can be used to request the +previous behavior. +