Message ID | ZAB7TAwFGPoJJqHT@tucnak |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 9D0BE3858C83 for <patchwork@sourceware.org>; Thu, 2 Mar 2023 10:33:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D0BE3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677753205; 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=IpMnMkU/OWhD0CY82ctinuELWyCn2NaAVsoJvwfS7hazggWqjbkzXjJSAaQoCpnfO VjXt68+wIRSlCV8n/2AAbYlVrAaAoCGs/VHUStuQPcHV7JGqlnwuLw7wEw3EteQDL5 UhsdLjcdjAz5532PYyPKAoY/x525d+TE4PkQDrmY= 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 <gcc-patches@gcc.gnu.org>; 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 <gerald@pfeifer.com>, Martin =?utf-8?b?TGnFoWth?= <mliska@suse.cz> Cc: gcc-patches@gcc.gnu.org Subject: [wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard Message-ID: <ZAB7TAwFGPoJJqHT@tucnak> References: <Y+UdYvqGpAggRqVD@tucnak> <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-Type: text/plain; charset=us-ascii 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard
|
|
Commit Message
Jakub Jelinek
March 2, 2023, 10:32 a.m. UTC
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 > > + <code>-fexcess-precision=fast</code>. 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 <code>float</code> and <code>double</code> expressions > > + are evaluated in <code>long double</code> precision and S/390, System z, > > + IBM z Systems where <code>float</code> expressions are evaluated in > > + <code>double</code> 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 > <code>float</code> and <code>double</code> 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
Comments
On 3/2/23 11:32, Jakub Jelinek wrote: > 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 >>> + <code>-fexcess-precision=fast</code>. 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 <code>float</code> and <code>double</code> expressions >>> + are evaluated in <code>long double</code> precision and S/390, System z, >>> + IBM z Systems where <code>float</code> expressions are evaluated in >>> + <code>double</code> 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 >> <code>float</code> and <code>double</code> 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: I like the suggested wording. Thanks for it. Martin > > 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.<br> > } > </code></pre> > > +<h3 id="excess-precision">Excess precision changes</h3> > +<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a> > +which has been implemented just in the C front-end before. The new behavior is > +enabled by default in <code>-std=c++</code><em>NN</em> modes and when > +<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point > +constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal > +to 2 on ia32: > + > +<pre><code> > +#include <stdlib.h> > +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 (); } > +</code></pre> > + > +will not abort with standard excess precision, because constants and expressions > +in <code>float</code> or <code>double</code> are evaluated in precision of > +<code>long double</code> and demoted only on casts or assignments, but will > +abort with fast excess precision, where whether something is evaluated in > +precision of <code>long double</code> or not depends on what evaluations are > +done in the i387 floating point stack or are spilled from it. > + > +The <code>-fexcess-precision=fast</code> option can be used to request the > +previous behavior. > + > </body> > </html> > > > Jakub >
On Thu, 2 Mar 2023, Jakub Jelinek wrote: > +<pre><code> > +#include <stdlib.h> Oops, in HTML we need to spell "<" as "<" and ">" as "> - otherwise the above would be seen as a tag by the name of stdlib.h. ;-) I pushed the follow-up patch below. Gerald commit 935fcdebfb2fb4dcd89edb51ebed5f1be0fb41e5 Author: Gerald Pfeifer <gerald@pfeifer.com> Date: Thu Mar 2 23:58:29 2023 +0100 gcc-13: Use < and > where necessary diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html index f0ccef69..953e1453 100644 --- a/htdocs/gcc-13/porting_to.html +++ b/htdocs/gcc-13/porting_to.html @@ -129,7 +129,7 @@ constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal to 2 on ia32: <pre><code> -#include <stdlib.h> +#include <stdlib.h> 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 (); } </code></pre>
On Fri, Mar 03, 2023 at 12:05:09AM +0100, Gerald Pfeifer wrote: > On Thu, 2 Mar 2023, Jakub Jelinek wrote: > > +<pre><code> > > +#include <stdlib.h> > > Oops, in HTML we need to spell "<" as "<" and ">" as "> - otherwise > the above would be seen as a tag by the name of stdlib.h. ;-) > > I pushed the follow-up patch below. Oops, missed that. Thanks. Jakub
On Thu, 2 Mar 2023, Jakub Jelinek wrote: > --- a/htdocs/gcc-13/porting_to.html > +++ b/htdocs/gcc-13/porting_to.html > +<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a> > +which has been implemented just in the C front-end before. The new behavior is > +enabled by default in <code>-std=c++</code><em>NN</em> modes and when > +<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point ^^^^^^ > +constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal > +to 2 on ia32: : > +will not abort with standard excess precision, because constants and expressions > +in <code>float</code> or <code>double</code> are evaluated in precision of > +<code>long double</code> and demoted only on casts or assignments, but will > +abort with fast excess precision, where whether something is evaluated in > +precision of <code>long double</code> or not depends on what evaluations are > +done in the i387 floating point stack or are spilled from it. > + > +The <code>-fexcess-precision=fast</code> option can be used to request the > +previous behavior. I struggled a bit understanding this and so have come up with what I hope is simpler (without changing the meaning). What do you think of the change below? Gerald diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html index 170da096..8a2822ff 100644 --- a/htdocs/gcc-13/porting_to.html +++ b/htdocs/gcc-13/porting_to.html @@ -122,12 +122,14 @@ the operand as an lvalue.<br> <h3 id="excess-precision">Excess precision changes</h3> -<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a> -which has been before implemented just in the C front end. The new behavior is -enabled by default in <code>-std=c++</code><em>NN</em> modes and e.g. when -<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point -constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal -to 2 on ia32: +<p>GCC 13 implements <a href="changes.html#cxx">excess precision +support</a>, which was implemented just in the C front end +before, in C++. The new behavior is enabled by default in +<code>-std=c++</code><em>NN</em> modes and when +<code>FLT_EVAL_METHOD</code> is 1 or 2 and affects the behavior of +floating point constants and expressions.</p> + +<p>E.g. for <code>FLT_EVAL_METHOD</code> equal to 2 on ia32 <pre><code> #include <stdlib.h> @@ -139,11 +141,11 @@ will not abort with standard excess precision, because constants and expressions in <code>float</code> or <code>double</code> are evaluated in precision of <code>long double</code> and demoted only on casts or assignments, but will abort with fast excess precision, where whether something is evaluated in -precision of <code>long double</code> or not depends on what evaluations are -done in the i387 floating point stack or are spilled from it. +<code>long double</code> precision depends on what evaluations are +done in the i387 floating point stack or are spilled from it.</p> -The <code>-fexcess-precision=fast</code> option can be used to request the -previous behavior. +</p>The <code>-fexcess-precision=fast</code> option can be used to +request the previous behavior.</p> <h3 id="alloc-rebind">allocator_traits<A>::rebind_alloc<A::value_type> must be A</h3>
On Thu, Mar 09, 2023 at 08:09:02AM +0100, Gerald Pfeifer wrote: > I struggled a bit understanding this and so have come up with what I > hope is simpler (without changing the meaning). > > What do you think of the change below? LGTM, thanks. > > diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html > index 170da096..8a2822ff 100644 > --- a/htdocs/gcc-13/porting_to.html > +++ b/htdocs/gcc-13/porting_to.html > @@ -122,12 +122,14 @@ the operand as an lvalue.<br> > > <h3 id="excess-precision">Excess precision changes</h3> > > -<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a> > -which has been before implemented just in the C front end. The new behavior is > -enabled by default in <code>-std=c++</code><em>NN</em> modes and e.g. when > -<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point > -constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal > -to 2 on ia32: > +<p>GCC 13 implements <a href="changes.html#cxx">excess precision > +support</a>, which was implemented just in the C front end > +before, in C++. The new behavior is enabled by default in > +<code>-std=c++</code><em>NN</em> modes and when > +<code>FLT_EVAL_METHOD</code> is 1 or 2 and affects the behavior of > +floating point constants and expressions.</p> > + > +<p>E.g. for <code>FLT_EVAL_METHOD</code> equal to 2 on ia32 > > <pre><code> > #include <stdlib.h> > @@ -139,11 +141,11 @@ will not abort with standard excess precision, because constants and expressions > in <code>float</code> or <code>double</code> are evaluated in precision of > <code>long double</code> and demoted only on casts or assignments, but will > abort with fast excess precision, where whether something is evaluated in > -precision of <code>long double</code> or not depends on what evaluations are > -done in the i387 floating point stack or are spilled from it. > +<code>long double</code> precision depends on what evaluations are > +done in the i387 floating point stack or are spilled from it.</p> > > -The <code>-fexcess-precision=fast</code> option can be used to request the > -previous behavior. > +</p>The <code>-fexcess-precision=fast</code> option can be used to > +request the previous behavior.</p> > > <h3 id="alloc-rebind">allocator_traits<A>::rebind_alloc<A::value_type> must be A</h3> > 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.<br> } </code></pre> +<h3 id="excess-precision">Excess precision changes</h3> +<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a> +which has been implemented just in the C front-end before. The new behavior is +enabled by default in <code>-std=c++</code><em>NN</em> modes and when +<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point +constants and expressions. E.g. for <code>FLT_EVAL_METHOD</code> equal +to 2 on ia32: + +<pre><code> +#include <stdlib.h> +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 (); } +</code></pre> + +will not abort with standard excess precision, because constants and expressions +in <code>float</code> or <code>double</code> are evaluated in precision of +<code>long double</code> and demoted only on casts or assignments, but will +abort with fast excess precision, where whether something is evaluated in +precision of <code>long double</code> or not depends on what evaluations are +done in the i387 floating point stack or are spilled from it. + +The <code>-fexcess-precision=fast</code> option can be used to request the +previous behavior. + </body> </html>