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] |
> > > The following patch resolves PR middle-end/24427 by implementing several > constant folding transformations of bitwise-AND and bitwise-OR of a > constant combinations. > > With this patch we now canonicalize (X|C1)&C2 as (X&C3)|C4 where we > always perform the bitwise-AND first, followed by the IOR. This > allows later optimizers to see the BIT_IOR_EXPR outermost, and imply > non-zeroness. Additionally, the patch implements several further > optimizations such as "(X & 1) | 1" -> "(X,1)" and "(X & ~1) | 1" -> > "X | 1". Finally, as a canonicalization step, BIT_AND_EXPR's constant > is simplified to the constant with the fewest set bits. This converts > "(X & 6) | 2" into the equalivalent "(X & 4) | 2". This should help > code generation on some platforms. > > Committed to mainline as revision 110918. > > 2006-02-13 Roger Sayle <roger@eyesopen.com> > > PR middle-end/24427 > * fold-const.c (fold_binary) <BIT_IOR_EXPR>: Transform (X&C1)|C2 > into (X,C2) if C1 is a subset of the bits of C2. Transform > (X&C1)|C2 into X|C2 if C1|C2 == ~0. Canonicalize (X&C1)|C2 as > (X&(C1&~C2))|C2. > <BIT_AND_EXPR>: Canonicalize (X|C1)&C2 as (X&C2)|(C1&C2). > > * gcc.dg/tree-ssa/andor-1.c: New test case. This also fixes PR 23670. Thanks, Andrew Pinski
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |