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') & 1 in fold_binary.
On Thu, Apr 21, 2005 at 10:54:41AM -0400, Kazu Hirata wrote:
> Now, I am wondering if it's worthwhile to revert the sense of your
> code. That is, if I get x & 4 != 0 in do_jump, should I convert it to
> (x >> 2) & 1? Jeff speculated that on some RISC machines, loading of
> constants is expensive, but if we are doing (x >> 2) & 1, we are
> loading 2 anyway (although it's as small as log2 of a constant that
> appears in x & C).
No, not any constant, "large" constants. In general, immediate shift
counts don't get loaded. Nor do "small" operands to logicals. But
you won't know which operands are small enough until you get to rtl.
r~