This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/4] match.pd: Add x & ~(x & y) -> x & ~y pattern
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, rv at rasmusvillemoes dot dk
- Date: Thu, 22 Jan 2015 09:22:42 +0100
- Subject: Re: [PATCH 2/4] match.pd: Add x & ~(x & y) -> x & ~y pattern
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 11 dot 1501212001150 dot 28775 at stedding dot saclay dot inria dot fr>
On Wed, Jan 21, 2015 at 9:00 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> (sorry for the broken thread, for some reason I haven't received any email
> from gcc since about 10am, I'll investigate later)
>
> +/* x & ~(x & y) -> x & ~y */
> +(simplify
> + (bit_and:c @0 (bit_not (bit_and:c@2 @0 @1)))
> + (if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2))
> + (bit_and @0 (bit_not @1))))
>
> Wouldn't it make more sense to put @2 on bit_not? If bit_and is used
> multiple times, the transformation is neutral so it should be done as a
> canonicalization. On the other hand, if bit_not is used multiple times, the
> transformation adds an extra bit_not (which might be free when there is an
> andn insn). So I believe the 2 main options are:
> - move @2 on the bit_not
> - don't test has_single_use at all
I tend to favor not testing has_single_use at all.
Richard.
> --
> Marc Glisse