public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andre Vieira <Andre.SimoesDiasVieira@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH][GCC] Algorithmic optimization in match and simplify
Date: Tue, 01 Sep 2015 13:40:00 -0000	[thread overview]
Message-ID: <55E5AACB.3050205@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1508281956570.9451@laptop-mg.saclay.inria.fr>

Hi Marc,

On 28/08/15 19:07, Marc Glisse wrote:
> (not a review, I haven't even read the whole patch)
>
> On Fri, 28 Aug 2015, Andre Vieira wrote:
>
>> 2015-08-03  Andre Vieira  <andre.simoesdiasvieira@arm.com>
>>
>>   * match.pd: Added new patterns:
>>     ((X {&,<<,>>} C0) {|,^} C1) {^,|} C2)
>>     (X {|,^,&} C0) {<<,>>} C1 -> (X {<<,>>} C1) {|,^,&} (C0 {<<,>>} C1)
>
> +(for op0 (rshift rshift lshift lshift bit_and bit_and)
> + op1 (bit_ior bit_xor bit_ior bit_xor bit_ior bit_xor)
> + op2 (bit_xor bit_ior bit_xor bit_ior bit_xor bit_ior)
>
> You can nest for-loops, it seems clearer as:
> (for op0 (rshift lshift bit_and)
>    (for op1 (bit_ior bit_xor)
>         op2 (bit_xor bit_ior)

Will do, thank you for pointing it out.
>
> +(simplify
> + (op2:c
> +  (op1:c
> +   (op0 @0 INTEGER_CST@1) INTEGER_CST@2) INTEGER_CST@3)
>
> I suspect you will want more :s (single_use) and less :c (canonicalization
> should put constants in second position).
>
I can't find the definition of :s (single_use). GCC internals do point 
out that canonicalization does put constants in the second position, 
didnt see that first. Thank you for pointing it out.

> +	C1 = wi::bit_and_not (C1,C2);
>
> Space after ','.
>
Will do.

> Having wide_int_storage in many places is surprising, I can't find similar
> code anywhere else in gcc.
>
>

I tried looking for examples of something similar, I think I ended up 
using wide_int because I was able to convert easily to and from it and 
it has the "mask" and "wide_int_to_tree" functions. I welcome any 
suggestions on what I should be using here for integer constant 
transformations and comparisons.

BR,
Andre

  reply	other threads:[~2015-09-01 13:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 17:29 Andre Vieira
2015-08-28 18:13 ` Marc Glisse
2015-09-01 13:40   ` Andre Vieira [this message]
2015-09-01 14:01     ` Richard Biener
2015-09-03 11:13       ` [PATCH v2][GCC] " Andre Vieira
2015-09-16 14:23         ` Andre Vieira
2015-09-17  9:52         ` Richard Biener
2015-09-25 11:44           ` Andre Vieira
2015-09-25 12:22             ` Richard Biener
2015-10-07  8:21               ` [PATCH V3][GCC] " Andre Vieira
2015-10-08 12:29                 ` Richard Biener
2015-10-09 16:11                   ` James Greenhalgh
2015-10-15 13:50                     ` Christophe Lyon
2015-10-19 11:49                       ` Richard Biener
2015-09-01 16:50 ` Location of "dg-final" directives? (was Re: [PATCH][GCC] Algorithmic optimization in match and simplify) David Malcolm
2015-09-01 16:55   ` Marek Polacek
2015-09-02 13:24     ` Andre Vieira

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=55E5AACB.3050205@arm.com \
    --to=andre.simoesdiasvieira@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).