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
Subject: Re: [PATCH][5/n] Remove GENERIC stmt combining from SCCVN
Date: Mon, 29 Jun 2015 08:17:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1506291015480.26650@zhemvz.fhfr.qr> (raw)
In-Reply-To: <alpine.DEB.2.20.1506271349450.1949@laptop-mg.saclay.inria.fr>

On Sat, 27 Jun 2015, Marc Glisse wrote:

> On Fri, 26 Jun 2015, Richard Biener wrote:
> 
> > + /* Equality compare simplifications from fold_binary  */
> > + (for cmp (eq ne)
> > +
> > +  /* If we have (A | C) == D where C & ~D != 0, convert this into 0.
> > +     Similarly for NE_EXPR.  */
> > +  (simplify
> > +   (cmp (convert?@3 (bit_ior @0 INTEGER_CST@1)) INTEGER_CST@2)
> > +   (if (tree_nop_conversion_p (TREE_TYPE (@3), TREE_TYPE (@0))
> > +        && wi::bit_and_not (@1, @2) != 0)
> > +    { constant_boolean_node (cmp == NE_EXPR, type); }))
> > +
> > +  /* (X ^ Y) == 0 becomes X == Y, and (X ^ Y) != 0 becomes X != Y.  */
> > +  (simplify
> > +   (cmp (bit_xor @0 @1) integer_zerop)
> > +   (cmp @0 @1))
> > +
> > +  /* (X ^ Y) == Y becomes X == 0.
> > +     Likewise (X ^ Y) == X becomes Y == 0.  */
> > +  (simplify
> > +   (cmp (bit_xor:c @0 @1) @0)
> 
> Don't you need cmp:c for this one? The transformation still somehow happens
> through forward_propagate_into_comparison, but it looks like an accident.

Yeah, I think it canonicalizes operand order (and uses the GENERIC
folding path).

I'm testing a patch changing the above to cmp:c.

> > +   (cmp @1 { build_zero_cst (TREE_TYPE (@1)); }))
> > +
> > +  /* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2).  */
> > +  (simplify
> > +   (cmp (convert?@3 (bit_xor @0 INTEGER_CST@1)) INTEGER_CST@2)
> > +   (if (tree_nop_conversion_p (TREE_TYPE (@3), TREE_TYPE (@0)))
> > +    (cmp @0 (bit_xor @1 (convert @2))))))
> 
> I guess we'll have to generalize this to vectors at some point...

True - I'm trying to move patterns 1:1 leaving improvements to followups

Thanks,
Richard.

      reply	other threads:[~2015-06-29  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 10:57 Richard Biener
2015-06-27 13:36 ` Marc Glisse
2015-06-29  8:17   ` Richard Biener [this message]

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.LSU.2.11.1506291015480.26650@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --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).