This is the mail archive of the
mailing list for the GCC project.
Re: [patch] genrecog.c: Simplify comparisons against small constantsin insn-recog.c.
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Henderson <rth at redhat dot com>, Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Jan 2004 06:38:53 -0700 (MST)
- Subject: Re: [patch] genrecog.c: Simplify comparisons against small constantsin insn-recog.c.
On Thu, 29 Jan 2004, Richard Henderson wrote:
> On Thu, Jan 29, 2004 at 02:53:06AM -0500, Kazu Hirata wrote:
> > Aside from a code size improvement of 0.2% on cc1, this patch replaces
> > a pointer chasing with a comparison against a link-time constant.
> It is not a link time constant. It's still a load from memory.
> Indeed, I don't see this as a real performance win at all.
If nothing else, the patch description implies it replaces two
comparisons with one. Isn't this simply an extension of the cleanup
"GET_CODE (x) == CONST_INT && XWINT (x, 0) == 0" to "x == const0_rtx"?
The first performs two memory accesses, the first to retrieve the RTX
code, the second to retrieve its operand, and two conditional jumps.
The second retrieves const0_rtx from the const_int_rtx array. I'm not
sure if genrecog.c is built with enable-checking, but that adds
significantly more overhead to the XWINT macro. With luck, all memory
references are equally hot, but I'll admit the first form may be more
CSE/GCSE-able in the generated code.
It would also be nice if we could somehow mark the const_int_rtx array
as const or unchanging once initialized?