public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Michael Meissner <meissner@linux.ibm.com>,
	 Peter Bergner <bergner@linux.ibm.com>,
	Bill Schmidt <wschmidt@linux.ibm.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>,
	David Edelsohn <dje.gcc@gmail.com>
Subject: Re: [PATCH] Fix SFmode subreg of DImode and TImode
Date: Thu, 9 Sep 2021 09:31:46 +0800	[thread overview]
Message-ID: <CAMZc-bxiBkEc9jmNd4fUjZ8piqjqWrPmZEH8pb38WcG8ZimNEg@mail.gmail.com> (raw)
In-Reply-To: <20210908191602.GQ1583@gate.crashing.org>

On Thu, Sep 9, 2021 at 3:17 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Wed, Sep 08, 2021 at 08:39:31PM +0200, Richard Biener wrote:
> > On September 8, 2021 7:08:09 PM GMT+02:00, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> > >It is not a good idea to do allow all those things.  Most backends can
> > >only support a few combinations of them, and everything else results in
> > >*worse* machine code, best case, and more and more complicated (and more
> > >buggy!) backend code.
> > >
> > >But that is a code quality issue.  The current problem is that we have
> > >at least PR102211 and PR102154 (as well as reports elsewhere of bugs on
> > >other targets).  Code that used before doesn't anymore, and we have no
> > >clear way out, no recommendation how to fix this and a) keep the same
> > >functionality without huge changes, and b) keep the same machine code
> > >quality.
> > >
> > >I do not think something like that can be done.  That is why I am asking
> > >for the patch to be reverted until all of the groundwork for it has been
> > >done.  That includes making generic testcases that show how such subregs
> > >behave, so that we can see in testresults what changes do to existing
> > >targets.
> >
> > Heh, I understood your earlier reply that you supported the change in principle based on the fact that nested subregs are invalid.
>
> Ah.  No.  I meant to lament the fact that we use subregs for multiple
> things, so that doing a bit_cast of a real subreg has to be expressed as
> just one subreg, which is clearly sub-optimal for most backends.
>
> I say *has to* because a subreg of a subreg is not valid RTL; it has to
> be written as just one subreg.  Which makes thing more confusing and
> confused than this already non-trivial thing has to be.
>
> > Now, I don't think that validate_subreg is supposed to be the decision maker on what a target allows.
>
> Right, some target hook or macro or whatnot should.
>
> > For subregs of hardregs we seem to have a good way of validating, but
> > what do we have for subregs of pseudos? Is it the passes generating
> > the new unsupported subregs that should do different things? Should
> > validate_subreg use a target hook to allow those special casings we
> > removed which all were necessary just for specific targets but
> > appearantly did not do any harm for other targets?
>
> Currently, we can disallow things in predicates and/or the instruction
> conditions.
>
> > Can you give advice as to how to address the needs of the HFmode subregs on x86 if not by adding another (generic) narrow exception in validate_subreg?
>
> If I knew what the problem was, perhaps?  Is this explained in some mail
> somewhere?
it's at [1], target_hook may not be the best solution, if other
targets support HFmode, they may encounter the same problem, and
revisit it again.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576827.html

>
> > That said, I fail to see a good way forward after now two appearantly failed attempts.
> >
> > Btw, I'm fine reverting the patch but then what's the solution here?
>
> I think we should (longer term) get rid of the overloaded meanings and
> uses of subregs.  One fairly simple thing is to make a new rtx code
> "bit_cast" (or is there a nice short more traditional name for it?)
>
> But that is not the core problem we had here.  The behaviour of the
> generic parts of the compiler was changed, without testing if that
> works on other targets but x86.  That is an understandable mistake, it
> takes some experience to know where the morasses are.  But this change
> should have been accompanied by testcases exercising the changed code.
> We would have clearly seen there are issues then, simply by watching
> gcc-testresults@ (and/or maintainers are on top of the test results
> anyway).  Also, if there were testcases for this, we could have some
> confidence that a change in this area is robust.
>
>
> Segher
>
>
> p.s. Very unrelated...  Should we have __builtin_bit_cast for C as well?
> Is there any reason this could not work?



-- 
BR,
Hongtao

  parent reply	other threads:[~2021-09-09  1:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  7:12 Michael Meissner
2021-09-07 23:07 ` Segher Boessenkool
2021-09-08  6:42   ` Richard Biener
2021-09-08 17:08     ` Segher Boessenkool
2021-09-08 17:50       ` David Edelsohn
2021-09-08 18:39       ` Richard Biener
2021-09-08 19:16         ` Segher Boessenkool
2021-09-09  1:23           ` Hongtao Liu
2021-09-09  1:31           ` Hongtao Liu [this message]
2021-09-09  6:16           ` Richard Biener
2021-09-09 22:53             ` Michael Meissner
2021-09-09 23:48             ` Segher Boessenkool
2021-09-10  3:09               ` Hongtao Liu
2021-09-10 10:54                 ` Richard Biener
2021-09-10 11:25                   ` Hongtao Liu
2021-09-10 12:34                     ` Hongtao Liu
2021-09-10 14:08                 ` David Edelsohn
2021-09-10 14:14                   ` Hongtao Liu
2021-09-10 15:32                 ` Segher Boessenkool
2021-09-10 10:53               ` Richard Biener
2021-09-10 15:05                 ` Segher Boessenkool
2021-09-13  9:03                   ` Richard Biener
2021-09-08 15:31   ` Michael Meissner
2021-09-09 21:59 ` Jim Wilson

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=CAMZc-bxiBkEc9jmNd4fUjZ8piqjqWrPmZEH8pb38WcG8ZimNEg@mail.gmail.com \
    --to=crazylht@gmail.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=meissner@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.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).