This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]