[PATCH] Fix PR69771, bogus CONST_INT during shift expansion
Jakub Jelinek
jakub@redhat.com
Mon Feb 15 18:15:00 GMT 2016
On Mon, Feb 15, 2016 at 06:58:45PM +0100, Richard Biener wrote:
> We could also force_reg those at expansion or apply SHIFT_COUNT_TRUNCATED to those invalid constants there.
Sure, but for force_reg we'd still need the gen_int_mode anyway.
As for SHIFT_COUNT_TRUNCATED, it should have been applied already from the
caller - expand_shift_1.
> >2016-02-15 Jakub Jelinek <jakub@redhat.com>
> >
> > PR rtl-optimization/69764
> > PR rtl-optimization/69771
> > * optabs.c (expand_binop): Ensure for shift optabs invalid CONST_INT
> > op1 is valid for mode.
> >
> >--- gcc/optabs.c.jj 2016-02-12 17:49:25.000000000 +0100
> >+++ gcc/optabs.c 2016-02-15 16:15:53.983673792 +0100
> >@@ -1125,6 +1125,12 @@ expand_binop (machine_mode mode, optab b
> > op1 = negate_rtx (mode, op1);
> > binoptab = add_optab;
> > }
> >+ /* For shifts, constant invalid op1 might be expanded from different
> >+ mode than MODE. */
> >+ else if (CONST_INT_P (op1)
> >+ && shift_optab_p (binoptab)
> >+ && UINTVAL (op1) >= GET_MODE_BITSIZE (GET_MODE_INNER (mode)))
> >+ op1 = gen_int_mode (INTVAL (op1), mode);
> >
> > /* Record where to delete back to if we backtrack. */
> > last = get_last_insn ();
Jakub
More information about the Gcc-patches
mailing list