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

*From*: Andrew Pinski <andrew dot pinski at caviumnetworks dot com>*To*: Richard Guenther <richard dot guenther at gmail dot com>*Cc*: GCC Patches <gcc-patches at gcc dot gnu dot org>*Date*: Thu, 19 Jan 2012 01:00:40 -0800*Subject*: Re: [PATCH] Fix PR 33512 Folding of x & ((~x) | y) into x & y on the tree level*References*: <CA+=Sn1kFkikJcCvjCk7W2e=ne06vM9yoBwfmr5u2oFesUBT7-A@mail.gmail.com> <CAFiYyc39Jo1a-M_CQJZx--hE6BU_A2g+sx_6KVs-XjgroOq7wA@mail.gmail.com>

On Tue, Jan 17, 2012 at 1:38 AM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Tue, Jan 17, 2012 at 8:06 AM, Andrew Pinski > <andrew.pinski@caviumnetworks.com> wrote: >> Hi, >> ÂThis adds the folding of x & ((~x) | y)) into x & y on the tree >> level via fold-const.c >> There is already partly done on the RTL level but it would be a good >> thing for the tree level also. >> >> >> OK for 4.8 (yes I know we have not branched yet but I thought I would >> send it out so I don't forget about it)? >> Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > Can you instead patch tree-ssa-forwprop.c:simplify_bitwise_binary? Yes and here is a new patch which also adds optimizing x | ((~x) & y)) to x | y. Also it adds the optimizing x & (x | y) to x and x | (x & y) to x to tree-ssa-forwprop.c:simplify_bitwise_binary since it was an easy extension on top of the ~x case (well I implemented the one without the ~ first). I did not remove those folding from fold-const.c though. Also I was thinking maybe this belongs in reassociate though I don't see how to do it. OK for 4.8, once in stage 1? Again bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski ChangeLog: * tree-ssa-forwprop.c (defcodefor_name): New function. (simplify_bitwise_binary): Use defcodefor_name. Simplify "( X | Y) & X" to X and "( X & Y) | X" to X. Simplify "(~X | Y) & X" to "X & Y" and "(~X & Y) | X" to "X | Y". testsuite/ChangeLog: * gcc.dg/tree-ssa/andor-3.c: New testcase. * gcc.dg/tree-ssa/andor-4.c: New testcase. * gcc.dg/tree-ssa/andor-5.c: New testcase. > > Thanks, > Richard. > >> Thanks, >> Andrew Pinski >> >> ChangeLog: >> * fold-const.c (fold_binary_loc <case BIT_AND_EXPR>): Add folding of x >> & (~x | y) into x & y. >> >> testsuite/ChangeLog: >> * gcc.dg/tree-ssa/andor-3.c: New testcase.

**Attachment:
addmoreandorforw.diff.txt**

**Follow-Ups**:**Re: [PATCH] Fix PR 33512 Folding of x & ((~x) | y) into x & y on the tree level***From:*Richard Guenther

**References**:**[PATCH] Fix PR 33512 Folding of x & ((~x) | y) into x & y on the tree level***From:*Andrew Pinski

**Re: [PATCH] Fix PR 33512 Folding of x & ((~x) | y) into x & y on the tree level***From:*Richard Guenther

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |