This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fold-const.c: Don't transform X & C into (X >> C') & 1in fold_binary.
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, law at redhat dot com, roger at eyesopen dot com
- Date: Wed, 20 Apr 2005 22:45:11 +0100
- Subject: Re: [patch] fold-const.c: Don't transform X & C into (X >> C') & 1in fold_binary.
- References: <20050420.172552.50360813.kazu@cs.umass.edu>
Hi Kazu,
Kazu Hirata <kazu@cs.umass.edu> writes:
> Roger agreed that it was a good idea to disable this transformation in
> fold, but I would like to know what others think as well. Jeff?
> Richard?
Certainly no objections here ;) As I suspect you know...
> IIRC, do_jump contains code to reverse the effect of
> fold_single_bit_test. If this patch is approved, I am planning to
> adjust that code as a follow-up patch.
...I only added that do_jump code because the conversion in fold
was causing a MIPS performance regression. I would have been much
happier removing the fold transformation if I thought I could have
got away with it, but others seemed to believe that it was useful
in some cases.
If your argument holds true, I'd be glad to see both the fold code
and the do_jump code removed. (At least, assuming I've understood
correctly, and that this:
> AFAICT, it does not matter whether we do this transformation or not as
> far as conditional branches are concerned. Combine canonicalizes a
> single bit test into zero_extract regardless of whether we have
>
> a & 4
>
> or
>
> (a >> 2) & 1
means that, even without the jump code, we will continue to avoid the
shift on MIPS if the user writes "(X >> 2) & 1" themselves.)
Richard