public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: "pinskia@gmail.com" <pinskia@gmail.com>,
	 "Hurugalawadi, Naveen" <Naveen.Hurugalawadi@caviumnetworks.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	 "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com>
Subject: Re: Fold some equal to and not equal to patterns in match.pd
Date: Tue, 21 Jul 2015 10:39:00 -0000	[thread overview]
Message-ID: <55AE1F86.7010809@arm.com> (raw)
In-Reply-To: <F510C178-CB96-43F9-8FA6-562889A4A3BD@gmail.com>


On 21/07/15 10:26, pinskia@gmail.com wrote:
>
>
>
>> 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.

Yes, I see it triggering there for aarch64, but I also see some undesired effects,
for example in gcc:
     lsl    x24, x24, 3
     cbz    x24, .L1194

now becomes:
     and    x0, x24, 2305843009213693951
     lsl    x24, x24, 3
     cbz    x0, .L1194

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

  reply	other threads:[~2015-07-21 10:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  9:16 Hurugalawadi, Naveen
2015-07-21  9:38 ` pinskia
2015-07-21 10:39   ` Kyrill Tkachov [this message]
2015-07-21 10:56     ` pinskia
2015-07-21 11:09       ` Kyrill Tkachov
2015-07-21 15:21       ` Kyrill Tkachov
2015-07-21  9:51 ` Jakub Jelinek
2015-07-21 19:55   ` Richard Biener
2015-07-22  7:09     ` Andrew Pinski
2015-07-22 11:22       ` Richard Biener
2015-07-22 13:50       ` Segher Boessenkool
2015-07-23 17:06       ` Jeff Law
2015-07-23 17:12         ` Segher Boessenkool
2015-07-24  7:48           ` Jeff Law
2015-07-24  8:01             ` Kai Tietz
2015-07-24  9:31               ` Richard Biener
2015-07-22 11:37 ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55AE1F86.7010809@arm.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=Andrew.Pinski@caviumnetworks.com \
    --cc=Naveen.Hurugalawadi@caviumnetworks.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).