[PATCH] [PR rtl-optimization/97249]Simplify vec_select of paradoxical subreg.

Segher Boessenkool segher@kernel.crashing.org
Wed Oct 21 16:34:22 GMT 2020


On Wed, Oct 21, 2020 at 04:43:29PM +0100, Richard Sandiford wrote:
> Hongtao Liu <crazylht@gmail.com> writes:
> > +	      poly_uint64 nunits
> > +		= GET_MODE_NUNITS (GET_MODE (SUBREG_REG (trueop0)));
> > +	      rtx par = trueop1;
> > +	      for (int i = 0; i != l1; i++)
> > +		{
> > +		  rtx idx = XVECEXP (trueop1, 0, i);
> > +		  if (!CONST_INT_P (idx)
> > +		      || maybe_ge (UINTVAL (idx) + subreg_offset, nunits))
> > +		    return 0;
> > +		}
> 
> I think the previous version was better.  We shouldn't assume that
> further simplification rules will fail just because the conditions
> for this rule haven't been met.

Yes.  My suggestion was to factor this big piece of code to a separate
function, and do an early return from *that*.

The patch is okay for trunk without that, with the clumsy booleans.
Thanks Hongtao!


Segher


More information about the Gcc-patches mailing list