This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Better info for combine results in worse code generated
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 28 May 2015 14:42:22 -0500
- Subject: Re: Better info for combine results in worse code generated
- Authentication-results: sourceware.org; auth=none
- References: <20150528143941 dot GL14752 at bubble dot grove dot modra dot org>
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