This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to fix bit-testing performance regression
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 18 Mar 2004 05:53:21 -0700 (MST)
- Subject: Re: Patch to fix bit-testing performance regression
On Thu, 18 Mar 2004, Richard Sandiford wrote:
>
> * Makefile.in (dojump.o): Depend on $(GGC_H) and dojump.h.
> (GTFILES): Add $(srcdir)/dojump.h.
> (gt-dojump.h): New dependency.
> * dojump.c (and_reg, and_test, shift_test): New static variables.
> (prefer_and_bit_test): New function.
> (do_jump): Use it to choose between (X & (1 << C)) and (X >> C) & 1.
>
Excellent. The use of rtx_costs is more advanced than I'd envisioned.
Ok for mainline.
My only thought was whether this should be placed before or after the
other transformation of BIT_AND_EXPR in dojump.c which changes the mode
of comparisons with integer constants. If you moved your transformation
earlier "(X >> 7) & 1" could be expanded as a test of a signed char's
sign bit, "(char)X < 0", for example. But hopefully this will be cleaned
up during RTL simplification anyway.
Your patch is approved as is, however for extra credit you might want to
investigate whether moving the hunk a few lines earlier improves initial
RTL generation.
Many thanks,
Roger
--