[PATCH] ((A & N) + B) & M optimization (PR tree-optimization/31261, take 2)

H.J. Lu hjl.tools@gmail.com
Mon Oct 4 01:12:00 GMT 2010


On Thu, Sep 30, 2010 at 6:46 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Sep 30, 2010 at 11:21:19AM +0200, Richard Guenther wrote:
>> Hm.  There's still nothing on GIMPLE that performs this then, right?
>
> True, it will hit probably only or mainly during FE folding.
>
>> In fact I have a hard time following the logic of the code as it tries
>> to handle the several cases without comments on what's going on ;)
>>
>> So, can you please add comments of the sort
>>
>>  /* Now we know the expression is of the form (x & b) & c ...  */
>
> Like this?
>
> 2010-09-30  Jakub Jelinek  <jakub@redhat.com>
>
>        PR tree-optimization/31261
>        * fold-const.c (fold_binary): Optimize ((A & N) + B) & M
>        for constants M and N, M == (1LL << cst) - 1 && (N & M) == M.
>
>        * gcc.dg/tree-ssa/pr31261.c: New test.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45876

H.J.



More information about the Gcc-patches mailing list