modulus question

James E Wilson wilson@specifixinc.com
Wed Aug 11 19:09:00 GMT 2004


Andrew Pinski wrote:
> Fold is changing (u%2)==0 into (u&1)==0 which gets changed to ((u^1) & 
> 1) != 0.

The culprit is fold_single_bit_test in fold-const.c.

This used to be part of do_store_flag, and it does make some sense 
there.  Simplifying a single bit test allows us to eliminate the compare 
that would otherwise be needed.

However, Jeff Law pulled this code out and started calling it from 
fold().  Now it gets used for if statement tests, and now we have a 
potential problem.  Since we will need to have a comparison for the 
branch anyways, some of the simplications performed here may actually 
make the code worse.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list