public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org,Marc Glisse <marc.glisse@inria.fr>,Marek
	Polacek <polacek@redhat.com>
Subject: Re: match.pd: Optimize (x & y) ^ (x | y)
Date: Thu, 11 Jun 2015 16:12:00 -0000	[thread overview]
Message-ID: <CAF7A0FC-E764-4D99-AE88-CE4ACADA3F52@suse.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1506111717100.8389@stedding.saclay.inria.fr>

On June 11, 2015 5:25:30 PM GMT+02:00, Marc Glisse <marc.glisse@inria.fr> wrote:
>On Thu, 11 Jun 2015, Marek Polacek wrote:
>
>> I have verified this transformation on a toy testcase (tried x and y
>> in the range [-1000,1000]) and it does a correct thing for all
>integers.
>
>Note that for pure bitop (only involving &|^), testing the range [0,1]
>is 
>sufficient.
>
>> +/* (x & y) ^ (x | y) -> x ^ y */
>> +(simplify
>> + (bit_xor:c (bit_and@2 @0 @1) (bit_ior@3 @0 @1))
>
>Make either bit_and or bit_ior commutative? Or do we canonicalize in a
>way 
>that makes it unnecessary?

Yes, operand canonicalization should make this unnecessary.

>> +  (if (single_use (@2) && single_use (@3))
>> +   (bit_xor @0 @1)))
>
>I don't think we should use single_use here. The result is never more 
>complicated than the original. Sure, it might increase register
>pressure a 
>bit in some cases, but we have not used that as a criterion for other 
>simplifications in match.pd yet (LLVM does though).

Hmm yes, you are right here.

Richard.

  reply	other threads:[~2015-06-11 16:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 11:08 Marek Polacek
2015-06-11 11:09 ` Richard Biener
2015-06-11 12:14   ` Marek Polacek
2015-06-11 11:18 ` Jakub Jelinek
2015-06-11 12:07   ` Marek Polacek
2015-06-11 20:12     ` Marc Glisse
2015-06-12  5:59       ` Richard Biener
2015-06-12  7:22         ` Marc Glisse
2015-06-12  9:04           ` Marek Polacek
2015-06-13 10:46             ` Marc Glisse
2015-06-16 13:47               ` Richard Biener
2015-06-11 15:26 ` Marc Glisse
2015-06-11 16:12   ` Richard Biener [this message]
2015-06-11 16:14   ` Marek Polacek
2015-06-11 16:34     ` Marc Glisse
2015-06-11 16:58       ` Marek Polacek

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=CAF7A0FC-E764-4D99-AE88-CE4ACADA3F52@suse.de \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    --cc=polacek@redhat.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).