Hi,

On Wed, 23 Nov 2016, Segher Boessenkool wrote:

> r242414, for PR77881, introduces some bugs (PR78390, PR78438, PR78477).
> It all has the same root cause: that patch makes combine convert every
> lowpart subreg of a logical shift right to a zero_extract.  This cannot
> work at all if it is not a constant shift,

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).

>       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))

GET_MODE (new_rtx), because that's the object you're giving to 
make_extraction, not inner (and not XEXP(inner, 0)).

> +                     - INTVAL (XEXP (inner, 1));
> +         if (width > mode_width)
> +           width = mode_width;
>           new_rtx = make_extraction (mode, new_rtx, 0, XEXP (inner, 1),
> -                                    mode_width, 1, 0, in_code == COMPARE);
> +                                    width, 1, 0, in_code == COMPARE);
>           break;
>         }


Ciao,
Michael.

Reply via email to