public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/96373] SVE miscompilation on vectorized division loop, leading to FP exception
Date: Wed, 05 Aug 2020 13:02:31 +0000	[thread overview]
Message-ID: <bug-96373-4-kD2wZYtdGK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96373-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96373

--- Comment #11 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #9)
> How do we represent sNaNs with -fnon-call-exceptions?  That is,

I think we're currently simply buggy at various stages as soon as sNaNs are
involved _and_ STDC FENV_ACCESS is ON.

>  y_1 = x_2 + 1.;
> 
> may trap.  Does
> 
>  foo (x_2);
> 
> get transformed to
> 
>  tem_3 = x_2;
>  foo (tem_3);
> 
> and the SSA assignment now traps dependent on whether the call
> ABI requires pushing x_2 to a stack slot (which might trap)?

If copying a sNaN (to registers or memory) signals an invalid-op depends on the
CPU (and is implementation defined in ieee754).  And GCC doesn't necessarily
preserve such signals even on CPUs that do signal (if there are any), because
it could e.g. use integer stores to transfer the bit patterns.

> sNaNs are odd anyway I guess.

> But yes, a pure function can still trap (and also throw).
> 
> I think we don't have a good notion for trappingness of calls
> and I do expect inconsistencies here.

__builtin_sqrtf isn't an arbitrary call.  FP operations aren't arbitrary
expressions.

We don't really have the problem of generating calls to arbitrary
arguments out of the blue, not even with non-throwing calls.  I'm not sure if
we should mix this problem here with that more generic problem.

Btw, that we if-convert calls to builtinf_sqrt is indeed a bug without
special options giving a license for that.  But doing that for the original
testcase instead of the division would _not_ be a problem on SVE: the inactive
lanes are zeroed and that doesn't signal anything for square root.

(We could perhaps extend the meaning of -fno-math-errno to give this license,
i.e. guarantee that the user hasn't enabled stops for any FP exceptions; but
that might be too aggressive).

  parent reply	other threads:[~2020-08-05 13:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 15:27 [Bug target/96373] New: " matz at gcc dot gnu.org
2020-08-04 13:41 ` [Bug target/96373] " rsandifo at gcc dot gnu.org
2020-08-04 13:49 ` rguenth at gcc dot gnu.org
2020-08-04 14:38 ` matz at gcc dot gnu.org
2020-08-04 14:59 ` rsandifo at gcc dot gnu.org
2020-08-04 15:46 ` schwab@linux-m68k.org
2020-08-05 10:08 ` rsandifo at gcc dot gnu.org
2020-08-05 10:15 ` rguenther at suse dot de
2020-08-05 10:28 ` rsandifo at gcc dot gnu.org
2020-08-05 11:09 ` rguenther at suse dot de
2020-08-05 12:24 ` matz at gcc dot gnu.org
2020-08-05 13:02 ` matz at gcc dot gnu.org [this message]
2023-01-11 23:50 ` pinskia at gcc dot gnu.org
2023-01-11 23:54 ` pinskia at gcc dot gnu.org
2023-01-27 17:04 ` cvs-commit at gcc dot gnu.org
2023-02-14  2:05 ` cvs-commit at gcc dot gnu.org
2023-02-14  9:18 ` cvs-commit at gcc dot gnu.org
2023-02-27  2:50 ` cvs-commit at gcc dot gnu.org
2023-02-27  2:57 ` cvs-commit at gcc dot gnu.org
2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
2023-04-14  8:19 ` [Bug target/96373] [10/11 Regression] " rguenth at gcc dot gnu.org
2023-05-29 10:03 ` jakub at gcc dot gnu.org
2024-02-29  5:33 ` [Bug target/96373] [11 " pinskia at gcc dot gnu.org

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=bug-96373-4-kD2wZYtdGK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).