This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fold some equal to and not equal to patterns in match.pd
- From: pinskia at gmail dot com
- To: "Hurugalawadi, Naveen" <Naveen dot Hurugalawadi at caviumnetworks dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "Pinski, Andrew" <Andrew dot Pinski at caviumnetworks dot com>
- Date: Tue, 21 Jul 2015 02:26:24 -0700
- Subject: Re: Fold some equal to and not equal to patterns in match.pd
- Authentication-results: sourceware.org; auth=none
- References: <DM2PR0701MB1018928F9138DEBCB2A0E9108E840 at DM2PR0701MB1018 dot namprd07 dot prod dot outlook dot com>
> 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>