On Sat, May 30, 2015 at 10:47:27AM +0930, Alan Modra wrote:
> > > > I think this is too simplistic though. For example, AND with -7 is not
> > > > zero-extended (rlwinm rD,rA,0,31,28 sets the high 32 bits of rD to the
> > > > low
> > > > 32 bits of rA).
> > >
> > > We take some pains in rs6000.md to ensure that the wrap-around case
> > > for rlwinm does not occur for TARGET_POWERPC64.
> >
> > I consider that a bug; it pessimises code.
>
> At the time I added the checks for wrap-around, I recall that gcc
> generated wrong code without the fix.
It still does: some of the things that use mask_operand cannot handle
a wrapped around (MB > ME) 32-bit mask in DImode.
> > > You'll find that an
> > > SImode AND with any value is in fact zero extending.
> >
> > int f(int x) { return x & 0xc0000000; }
> >
> > is a counter-example with current trunk (it does a rldicr).
>
> Huh, that does look like you've destroyed my claim about SImode AND.
Carefully worded :-)
I don't think it is a good idea to optimise code based on assumptions
of what SImode SETs will do to the dest seen as DImode, without making
those assumptions explicit in the RTL.
Segher