From: Marc Glisse <marc.glisse@inria.fr>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH][5/n] Remove GENERIC stmt combining from SCCVN
Date: Sat, 27 Jun 2015 13:36:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1506271349450.1949@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <alpine.LSU.2.11.1506261253530.26650@zhemvz.fhfr.qr>
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.
> + (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...
--
Marc Glisse
next prev parent reply other threads:[~2015-06-27 12:55 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 [this message]
2015-06-29 8:17 ` 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=alpine.DEB.2.20.1506271349450.1949@laptop-mg.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).