This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH ppc64,aarch64,alpha 00/15] Improve backend constant generation
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <richard dot earnshaw at arm dot com>
- Date: Wed, 12 Aug 2015 22:06:52 -0500
- Subject: Re: [PATCH ppc64,aarch64,alpha 00/15] Improve backend constant generation
- Authentication-results: sourceware.org; auth=none
- References: <1439341904-9345-1-git-send-email-rth at redhat dot com> <20150812083148 dot GE4711 at gate dot crashing dot org> <55CB671E dot 9090705 at redhat dot com>
On Wed, Aug 12, 2015 at 08:32:46AM -0700, Richard Henderson wrote:
> On 08/12/2015 01:31 AM, Segher Boessenkool wrote:
> > Is there something that makes the cache not get too big? Do we
> > care, anyway?
>
> No, nothing ever reduces the size of the cache. I doubt we care, but I haven't
> instrumented to see how big it grows.
>
> My intuition says the most important thing about managing this cache is not to
> put the most common trivial constants in, and I already do that.
Right. And it seems to cache negative results too (the five-insn
sequence).
> >> I did attempt to fix it, and got nothing for my troubles except
> >> poorer code generation for AND/IOR/XOR with non-trivial constants.
> >
> > Could you give an example of code that isn't split early enough?
>
> I believe the examples I was seeing was in the libdecnumber code. I'd have to
> go back and reproduce it now...
If you could, please do.
> >> Perhaps there's some other predication or costing error that's
> >> getting in the way, and it simply wasn't obvious to me. In any
> >> case, nothing in this patch set addresses this at all.
> >
> > The instruction (set (reg) (const_int 0x12345678)) is costed as 4
> > (i.e. one insn). That cannot be good. This is alternative #5 in
> > *movsi_internal1_single (there are many more variants of that
> > pattern).
>
> Yes, when I tried to fix it, I did adjust that costing, but still...
I misread it (it's alt #6, with cost 8). Maybe Alan's patches would
fix this one?
> >> * Constants are split *really* late. In particular, after reload.
> >
> > Yeah that is bad. But I'm still not seeing it. Hrm, maybe only
> > DImode ones?
>
> Dunno. I found it after I did add a recipe to use ADDI, which then triggered
> an ICE due to the r0 base register.
Ah! Reload generates *new* addition insns out of thin air, and that
is exactly the case where ADDI won't work. LRA works a bit better
there it seems (but it is still not the default for rs6000); if the
constraint ("b" in this case) would not match, it tries other things.
> > Have you looked at generated code quality?
>
> I've looked at diffs of all of the object files in the target directory. There
> were definite spots of improvement. I wasn't able to spot any regressions.
[ I've looked now. ]
Some of the new combos help a bit, yes. Total code size increased
a tiny bit; it looks to be all because of unfortunate scheduling and
less tail merging. The usual.
32-bit code is identical, as it should be ;-)
Segher