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] fold-const.c: Don't transform X & C into (X >> C') & 1in fold_binary.


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


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