On Fri, May 29, 2015 at 12:09:42AM +0930, Alan Modra wrote:
> It's really annoying when you fix a combine bug and get worse code..

Heh.  You've been on the receiving end of that a lot lately :-/

> void foo (signed char *p) { if (*p != 0) *p = 1; }
> 
>       before                  after
> foo:                  foo:
>       lbz 9,0(3)              lbz 9,0(3)
>       cmpwi 7,9,0             andi. 10,9,0xff
>       beqlr 7                 beqlr 0
>       li 9,1                  li 9,1
>       stb 9,0(3)              stb 9,0(3)
>       blr                     blr
> 
> That record form andi. is slower on many processors,

Is it?  On which processors?

> and restricted to setting cr0.

Yes.  If it is allocated a different crn it is split to a rlwinm and a
cmpw, but that is much too late for the rlwinm to be combined with the
lbz again.

> one of the aims of the wider patch I was working
> on was to remove patterns like rotlsi3_64, ashlsi3_64, lshrsi3_64 and
> ashrsi3_64.

We will need such patterns no matter what; the compiler cannot magically
know what machine insns set the high bits of a 64-bit reg to zero.

We should have something nicer than the current duplication though.  Maybe
define_subst can help.  Maybe something a little bit more powerful than
that is needed though.


Segher

Reply via email to