public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: Jeff Law <law@redhat.com>, Paul Koning <paulkoning@comcast.net>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] genemit: Handle `const_double_zero' rtx
Date: Wed, 16 Dec 2020 13:30:02 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LFD.2.21.2012161313590.2104409@eddie.linux-mips.org> (raw)
In-Reply-To: <mpt8s9ysznx.fsf@arm.com>

On Wed, 16 Dec 2020, Richard Sandiford wrote:

> >> Presumably you can't use CONST0_RTX (mode) here?  Assuming that's the
> >> case, then this is fine.
> >
> >  Well, `mode' is VOID for simplicity and to match what the middle end 
> > presents as an operand to the COMPARE operation, as also shown with the 
> > diff above, so with CONST0_RTX (mode) we'd be back to what amounts to 
> > `const0_rtx' aka `const_int 0', which is exactly what we want to get away 
> > from.
> >
> >  Alternatively we could possibly give `const_double_zero' a proper FP 
> > mode, but it seems to me like an unnecessary complication, as it would 
> > then have to be individually requested and iterated over all the relevant 
> > modes.
> 
> Generated FP const_double rtxes have to have a proper (non-VOID) mode
> though.  VOIDmode CONST_DOUBLEs are always (legacy) integers instead
> of FP values.
> 
> So yeah, giving const_double_zero a proper mode seems like the way to go.
> It's technically possible to drop it in a pure matching context, but I'm
> not sure how valuable that is in practice, given that other parts of the
> matched pattern would usually need to refer to the same mode anyway.

 Fair enough.  For some reason however VOIDmode CONST_DOUBLEs seem to work 
with the FP operations in the VAX backend for the purpose of post-reload 
comparison elimination while CONST_INTs do not.

> >  Have I missed anything here?
> >
> >  NB the PDP-11 pieces affected here and tripping this assertion are I 
> > believe dead code, as these insns are only ever produced by splitters and 
> > do not appear to be referred by their names.  We need this change however 
> > for completeness so that `const_double_zero' can be used in contexts where 
> > an insn actually will be referred by its name.
> >
> >  However the PDP-11 code being dead makes it a bit more difficult to 
> > examine actual consequences of such a change like I have proposed than it 
> > would otherwise be.  In these circumstances I think my proposal is safe if 
> > a bit overly cautious.
> 
> CONST_DOUBLE_ATOF ("0", VOIDmode) seems malformed though, and I'd expect
> it to assert in REAL_MODE_FORMAT (via the format_helper constructor).
> I'm not sure the patch is strictly safer than the status quo.

 I may have missed that, though I did follow the chain of calls involved 
here to see if there is anything problematic.  As I say I have a limited 
way to verify this in practice as the PDP-11 code involved appears to me 
to be dead, and the situation does not apply to the VAX backend.  Maybe I 
could simulate it somehow artificially to see what happens.

> FWIW, I agree with Jeff that this ought to be CONST0_RTX (mode).

 I'll have to update several places then and push the changes through full 
regression testing, so it'll probably take until the next week.

 Thanks for your input!

  Maciej

  reply	other threads:[~2020-12-16 13:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 20:38 Maciej W. Rozycki
2020-12-15 23:20 ` Jeff Law
2020-12-16 11:35   ` Maciej W. Rozycki
2020-12-16 12:28     ` Richard Sandiford
2020-12-16 13:30       ` Maciej W. Rozycki [this message]
2021-01-05 23:51         ` Maciej W. Rozycki
2021-01-06 16:34           ` Richard Sandiford
2021-01-08  2:12             ` Maciej W. Rozycki
2020-12-16 19:19     ` Paul Koning
2020-12-16 20:43       ` Maciej W. Rozycki

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=alpine.LFD.2.21.2012161313590.2104409@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=paulkoning@comcast.net \
    --cc=richard.sandiford@arm.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).