On Thu, Dec 15, 2016 at 09:55:52AM +0100, Dominik Vogt wrote:
> > > Bootstrapped and regression tested on s390x and s390.  (Targets
> > > with risbg-like instructions (Power, others?) may need some
> > > tuning.)
> > 
> > But, it is also possible I missed some.  So please wait until I have
> > tested it.
> > 
> > > diff --git a/gcc/combine.c b/gcc/combine.c
> > > index 19851a2..5ebf31c 100644
> > > --- a/gcc/combine.c
> > > +++ b/gcc/combine.c
> > > @@ -11280,8 +11280,13 @@ change_zero_ext (rtx pat)
> > >        else
> > >   continue;
> > >  
> > > -      wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode));
> > > -      x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode));
> > > +      if (!(GET_CODE (x) == LSHIFTRT
> > > +     && CONST_INT_P (XEXP (x, 1))
> > > +     && size + INTVAL (XEXP (x, 1)) == GET_MODE_PRECISION (mode)))
> > > + {
> > > +   wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode));
> > > +   x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode));
> > > + }
> > 
> > One could argue that this should have been an lshiftrt in the first place
> > then, not a zero_ext*.  Hrm.
> 
> This one
> 
>   void g2(ui64 *pl, i32 seed)
>   {
>     seed = 69607 * seed;
>     pl[0] = (seed >> 8) & 0xffffff;
>   }
> 
> generates
> 
>   (zero_extract:DI (reg:SI 75 [ seed ])
>     (const_int 24 [0x18])
>     (const_int 0 [0]))
> 
> on s390x.

Ah, right, it changes mode as well.  I see.

Tested on powerpc64-linux {-m32,-m64}, no new failures.  The patch is
okay for trunk.  Thanks!


Segher

Reply via email to