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]

Re: Fold some equal to and not equal to patterns in match.pd





> On Jul 21, 2015, at 2:15 AM, Hurugalawadi, Naveen <Naveen.Hurugalawadi@caviumnetworks.com> wrote:
> 
> Hi,
> 
> Please find attached the patch which performs following patterns folding
> in match.pd:-
> 
> a ==/!= a p+ b to b ==/!= 0.
> a << N ==/!= 0 to a&(-1>>N) ==/!= 0.
> a * N ==/!= 0 where N is a power of 2 to a & (-1<<N2) ==/!= 0 where N2 is log2 of N.
> 
> Please review the same and let us know if its okay?

I should note this shows up in perlbmk in spec 2006. 

Thanks,
Andrew

> 
> Regression Tested on X86_64.
> 
> On Behalf of Andrew Pinski.
> 
> Thanks,
> 
> gcc/testsuite/ChangeLog:
> 
> 2015-01-21  Andrew Pinski  <apinski@cavium.com>
> 
>    * testsuite/gcc.dg/tree-ssa/compare-shiftmult-1.c: New testcase.
>    * testsuite/gcc.dg/tree-ssa/compare_pointers-1.c: New testcase.
> 
> gcc/ChangeLog:
> 
> 2015-01-21  Andrew Pinski  <apinski@cavium.com>
> 
>    * match.pd (define_predicates): Add integer_pow2p.
>    Add pattern for folding of a ==/!= a p+ b to b ==/!= 0.
>    (unsigned_integral_valued_p): New match.
>    Add pattern for folding of a<<N ==/!= 0 to a&(-1>>N) ==/!= 0.
>    Add pattern for folding of a*N ==/!= 0 where N is a power of 2
>    to a&(-1<<N2) ==/!= 0 where N2 is log2 of N.
> <gcc_match.patch>


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