This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][5/n] Remove GENERIC stmt combining from SCCVN
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Jun 2015 10:16:57 +0200 (CEST)
- Subject: Re: [PATCH][5/n] Remove GENERIC stmt combining from SCCVN
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1506261253530 dot 26650 at zhemvz dot fhfr dot qr> <alpine dot DEB dot 2 dot 20 dot 1506271349450 dot 1949 at laptop-mg dot saclay dot inria dot 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.