public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [RTL] Canonicalize commutative operations more
Date: Sat, 30 Mar 2013 12:49:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1303301322310.12904@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <2628063.UuGJrOXufS@polaris>

On Wed, 27 Mar 2013, Eric Botcazou wrote:

>> This patch passes bootstrap+testsuite on x86_64-linux-gnu. Using the
>> opposite arbitrary order in compare_commutative_operands_precedence
>> (exchange x and y in the line with GET_CODE) passes as well. The
>> simplify-rtx bit is because I get an infinite recursion otherwise.
>> Surprisingly, that infinite recursion occurs only in var-tracking, and
>> only for a single file in bootstrap+testsuite (not the same one depending
>> on the arbitrary order). I am not sure that is the best place to break the
>> recursion, but it seems to work.
>>
>> I don't really expect the patch to be accepted as is, but it seems good
>> enough to start the conversation.
>
> I'm rather with Jakub here, I think that arbitrary canonicalization as the one
> proposed here will probably be worse than no canonicalization in practice,
> because it will generate much shuffling.  If you need more canonicalization,
> then why not propose new, precise canonicalization rules?

Well, the goal was to have arbitrary canonicalization for all cases where 
precise rules are not already provided. In (a<<8)|(b>>24), there is no 
obvious reason why lshift should have higher or lower priority than 
rshift, but we don't want to have to write patterns with both orders in 
the target .md files. In v[0]+v[1] (v is a V2DF), it is likewise 
preferable if we know in which order the operands will appear, but I don't 
care what that order is (note that ordering this one requires a refinement 
that I didn't include in this first version of the patch). And this way we 
don't have to refine the order all the time, we just check what order this 
arbitrary rule generates and write the pattern accordingly.

I am not sure about adding just a few rules. If I just say that lshift is 
stronger than rshift, the relation is not an order (transitive) anymore. 
And it might already have some of the drawbacks you and Jakub fear (I 
don't have a good understanding of those, I may be wrong).

If there is a nice way to instead try permutations (note that for a 
pattern involving k commutative operations, there are 2^k versions), I am 
just as happy with that.

By the way, even if we don't take the canonicalization (just ignore the 
line comparing GET_CODEs), do we still want the refactoring that this 
patch brings, or is the current interface better?

-- 
Marc Glisse

  reply	other threads:[~2013-03-30 12:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 17:14 Marc Glisse
2013-03-27 10:01 ` Eric Botcazou
2013-03-30 12:49   ` Marc Glisse [this message]
2013-04-02  9:23     ` Eric Botcazou
2013-04-02 11:12       ` Marc Glisse
2013-04-02 11:44         ` Eric Botcazou
2013-04-02 17:19           ` Jeff Law
2013-04-04 18:57       ` Mike Stump

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=alpine.DEB.2.02.1303301322310.12904@laptop-mg.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=ebotcazou@adacore.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).