This is the mail archive of the gcc@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: modulus question





James E Wilson wrote on 08/11/2004 02:07:55 PM:

> 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.


Appears the real cause of the instance I observed was due to combine.c no
longer combining the xor/and/compare sequence into a compare with
zero_extract as it was doing for 3.4. Mainline is leaving the xor alone for
some reason.

Not that this justifies the current state of fold-const.c, we just used to
clean up the sequence better. Which probably adds strength to the argument
that we shouldn't do it in the first place (for if statements).

-Pat


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