public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "Gerald Pfeifer" <gerald@pfeifer.com>, "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: [wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard
Date: Thu, 2 Mar 2023 11:32:44 +0100	[thread overview]
Message-ID: <ZAB7TAwFGPoJJqHT@tucnak> (raw)
In-Reply-To: <541d2859-4029-3a21-e57e-10a401c5d226@pfeifer.com>

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:

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


  reply	other threads:[~2023-03-02 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 16:20 [wwwdocs] gcc-13/changes.html: " Jakub Jelinek
2023-02-10  9:06 ` Gerald Pfeifer
2023-03-02 10:32   ` Jakub Jelinek [this message]
2023-03-02 12:40     ` [wwwdocs] gcc-13/porting_to.html: " Martin Liška
2023-03-02 23:05     ` Gerald Pfeifer
2023-03-02 23:16       ` Jakub Jelinek
2023-03-09  7:09     ` Gerald Pfeifer
2023-03-09  8:05       ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAB7TAwFGPoJJqHT@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).