public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Richard Biener <rguenther@suse.de>, Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gimple-fold: Don't optimize wierdo floating point value reads [PR95450]
Date: Mon, 24 Aug 2020 11:44:54 -0600	[thread overview]
Message-ID: <85820caf84b54fcc0e994f4aebd7d4e9a128280e.camel@redhat.com> (raw)
In-Reply-To: <nycvar.YFH.7.76.2008241251170.9963@zhemvz.fhfr.qr>

On Mon, 2020-08-24 at 12:51 +0200, Richard Biener wrote:
> On Wed, 12 Aug 2020, Jakub Jelinek wrote:
> 
> > On Wed, Aug 12, 2020 at 04:30:35PM +0200, Richard Biener wrote:
> > > Not a final review but if we care for this kind of normalization at all
> > > the we should do so consistently, thus for both encode and interpret and
> > > for all modes.  For FP we could also check if we'd consider the values
> > > equal rather than whether we would en/decode them to the same bit pattern
> > > (which might or might not be what an actual ISA gpr<->fpr reg move would
> > > do)
> > 
> > I think the verification that what we encode can be interpreted back
> > woiuld be only an internal consistency check (so perhaps for ENABLE_CHECKING
> > if flag_checking only, but if both directions perform it, then we need
> > to avoid mutual recursion).
> > While for the other direction (interpretation), at least for the broken by
> > design long doubles we just know we can't represent in GCC all valid values.
> > The other floating point formats are just theoretical case, perhaps we would
> > canonicalize something to a value that wouldn't trigger invalid exception
> > when without canonicalization it would trigger it at runtime, so let's just
> > ignore those.
> > 
> > Adjusted (so far untested) patch to do it in native_interpret_real instead
> > and limit it to the MODE_COMPOSITE_P cases, for which e.g.
> > fold-const.c/simplify-rtx.c punts in several other places too because we just
> > know we can't represent everything.
> > 
> > E.g.
> >       /* Don't constant fold this floating point operation if the
> >          result may dependent upon the run-time rounding mode and
> >          flag_rounding_math is set, or if GCC's software emulation
> >          is unable to accurately represent the result.  */
> >       if ((flag_rounding_math
> >            || (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations))
> >           && (inexact || !real_identical (&result, &value)))
> >         return NULL_TREE;
> > Or perhaps guard it with MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations
> > too, thus break what gnulib / m4 does with -ffast-math, but not normally?
> 
> OK.
> 
> Richard.
> 
> > 2020-08-12  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	PR target/95450
> > 	* fold-const.c (native_interpret_real): For MODE_COMPOSITE_P modes
> > 	punt if the to be returned REAL_CST does not encode to the bitwise
> > 	same representation.
Jakub, can you pull this into F33/F34.  It's affecting a few packages (assuming
this is meant to fix the gnulib FP testsuite failures on ppc64le).

Jeff


      reply	other threads:[~2020-08-24 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12  8:45 Jakub Jelinek
2020-08-12 14:30 ` Richard Biener
2020-08-12 15:33   ` Jakub Jelinek
2020-08-24 10:51     ` Richard Biener
2020-08-24 17:44       ` Jeff Law [this message]

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=85820caf84b54fcc0e994f4aebd7d4e9a128280e.camel@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).