public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gcc-patches@gcc.gnu.org, joseph@codesourcery.com,
	       richard.guenther@gmail.com
Subject: Re: [PATCH v2] Fix -ffast-math flags handling inconsistencies
Date: Tue, 11 Feb 2020 23:56:00 -0000	[thread overview]
Message-ID: <20200211235559.GZ22482@gate.crashing.org> (raw)
In-Reply-To: <20200211184332.0968DD80313@oc3748833570.ibm.com>

Hi!

On Tue, Feb 11, 2020 at 07:43:31PM +0100, Ulrich Weigand wrote:
> 1. If a component flag of -ffast-math (or -funsafe-math-optimizations)
>    is explicitly set (or reset) on the command line, this should override
>    any implicit change due to -f(no-)fast-math, no matter in which order
>    the flags come on the command line.  This change affects all flags.

Ack.

> 2. Any component flag modified from its default by -ffast-math should
>    be reset to the default by -fno-fast-math.  This was previously
>    not done for the following flags:
>       -fcx-limited-range
>       -fexcess-precision=

Ack.

> 3. Once -ffinite-math-only is true, the -f(no-)signaling-nans flag has
>    no meaning (if we have no NaNs at all, it does not matter whether
>    there is a difference between quiet and signaling NaNs).  Therefore,
>    it does not make sense for -ffast-math to imply -fno-signaling-nans.
>    This is also a documentation change.

Ack.

> 4. -ffast-math is documented to imply -fno-rounding-math, however the
>    latter setting is the default anyway; therefore it does not make
>    sense to try to modify it from its default setting.

Ack.  It might be more robust to *do* set it, so that it still works if
the default ever changes.

> 5. The __FAST_MATH__ preprocessor macro should be defined if and only
>    if all the component flags of -ffast-math are set to the value that
>    is documented as the effect of -ffast-math.  The following flags
>    were currently *not* so tested:
>      -fcx-limited-range
>      -fassociative-math
>      -freciprocal-math
>      -frounding-math
>    (Note that we should still *test* for -fno-rounding-math here even
>    though it is not set as per 4.  -ffast-math -frounding-math should
>    not set the __FAST_MATH__ macro.)
>    This is also a documentation change.

Ack.

All looks good to me, but I'm not maintainer of this.

This should be mentioned in the release notes I think, it does change
behaviour (for the better, but any change is a change).

Thanks,


Segher

  reply	other threads:[~2020-02-11 23:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 18:43 Ulrich Weigand
2020-02-11 23:56 ` Segher Boessenkool [this message]
2020-11-21  4:33 ` Jeff Law
2020-11-21 19:57   ` Segher Boessenkool
2020-11-24 10:55     ` [wwwdocs] " Ulrich Weigand
2020-11-24 17:19       ` Segher Boessenkool
2020-11-24 18:42   ` Ulrich Weigand
2020-11-24 23:23     ` Segher Boessenkool
2020-11-25 13:12     ` Christophe Lyon

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=20200211235559.GZ22482@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=richard.guenther@gmail.com \
    --cc=uweigand@de.ibm.com \
    /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).