Hi,

On Wed, 23 Nov 2016, Segher Boessenkool wrote:

> > Even with non-constant shifts it remains an extract and make_extraction 
> > does support variable start positions (which is the shift amount), as does 
> > the zero_extract pattern (depending on target of course).
> 
> Sure, but the extraction length is non-constant as well then!  And not
> just not-constant, with a conditional inside it, even.

Right, that would be the consequence.  I don't see much care for this 
problem anywhere, which probably hints that there aren't many targets 
accepting variant positions for zero_extract :)

> > >   if (GET_CODE (inner) == LSHIFTRT
> > > +     && CONST_INT_P (XEXP (inner, 1))
> > >       && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner))
> > >       && subreg_lowpart_p (x))
> > >     {
> > >       new_rtx = make_compound_operation (XEXP (inner, 0), next_code);
> > > +     int width = GET_MODE_PRECISION (GET_MODE (inner))
> > > +                 - INTVAL (XEXP (inner, 1));
> > 
> > GET_MODE (new_rtx), because that's the object you're giving to 
> > make_extraction, not inner (and not XEXP(inner, 0)).
> 
> This is about the *original* rtx, the lshiftrt: how many non-zero bits
> does that leave.  The bits zeroed out by the lshiftrt have to be zeroed
> out by the zero_extract as well, to keep the same semantics in the
> resulting rtl.

Of course.  I saw it more as a requirements on the inputs of 
make_extraction.  In the end this is moot, as all three modes (of inner, 
of (inner,0) and of new_rtx) are the same :)


Ciao,
Michael.

Reply via email to