On Fri, Sep 10, 2021 at 12:53:37PM +0200, Richard Biener wrote:
> On Fri, Sep 10, 2021 at 1:50 AM Segher Boessenkool
> <seg...@kernel.crashing.org> wrote:
> > And many targets have strange rules for bit-strings in which modes can
> > be used as bit-strings in which other modes, and at what offsets in
> > which registers.  Now perhaps none of that is optimal (I bet it isn't),
> > but changing this without a transition plan simply does not work.
> 
> But we _do_ already allow some of them :/  Like

Yes.  And all of this is old and ingrained, and targets depend on the
status quo, so changing this will need more care and planning and
cooperation.  It certainly is a worthwhile thing to improve, but it is
not a small project, and it requires a plan.

>   /* ??? Similarly, e.g. with (subreg:DF (reg:TI)).  Though store_bit_field
>      is the culprit here, and not the backends.  */
>   else if (known_ge (osize, regsize) && known_ge (isize, osize))
>     ;
> 
> so for the special case where 'regsize' matches osize it would be
> a bit-cast of a full register from int to float.  But as written it also
> allows (subreg:XF (reg:TI))  which will likely wreck havoc?

That does not pass the isize >= osize test?  Or maybe I don't know
what XFmode is well enough :-)  Hey I can read, I have source, and it
is Friday...

Ah.  So XF has different size on 32-bit and on 64-bit, but that doesn't
even matter here.

> Similar for the omode == word_mode check which allows
> (subreg:DI (reg:TF ..)).  That is, the existing special-cases look
> too broad to me - and they probably exist because when validate_subreg
> rejects sth then we can't put it together later when expand split it
> into two subregs and a pseudo ...

I said it before, and I'll say it again, it is a very important point:
expand should not try to optimise this, *at all*.  And not just this,
not *anything*.  Expand's job in the current compiler is only to
translate Gimple to RTL, and nothing more.

When later passes try to optimise things they will always ask the target
if it agrees with the change (all RTL has to pass recog() for example).
This simplifies life.


Segher

Reply via email to