This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Move "(A & C) == D is false when D & ~C != 0" to match.pd
- 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>
- Date: Mon, 22 May 2017 09:36:55 +0200
- Subject: Re: Move "(A & C) == D is false when D & ~C != 0" to match.pd
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.02.1705201950300.5470@stedding.saclay.inria.fr>
On Sat, May 20, 2017 at 8:27 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> as asked, I am adding some replacement in match.pd instead of just deleting
> this (redundant with CCP). It is not clear how general the match.pd version
> needs to be. (for instance it could handle some casts in addition to what I
> have written)
>
> The expansion results in a few non-canonical patterns (thus unreachable
> code), but avoiding them would make the code longer and less readable.
>
> I wondered about naming with_possible_nonzero_bits INTEGER_CST_or_SSA_NAME
> instead.
>
> I would like to rename get_nonzero_bits to get_possible_nonzero_bits or
> get_possibly_nonzero_bits, something more explicit, and introduce
> get_certain(ly)_nonzero_bits that would always return 0 for SSA_NAME for a
> start (but hopefully the next person who rewrites this stuff (merge CCP with
> VRP for instance?) will implement it). It would allow for more symmetry in
> the transformations and make the intent clearer.
I think get_nonzero_bits and its behavior is modeled after nonzero_bits on RTL.
> Bootstrap+testsuite on powerpc64le-unknown-linux-gnu.
Ok.
Thanks,
Richard.
> 2017-05-22 Marc Glisse <marc.glisse@inria.fr>
>
> * fold-const.c (fold_binary_loc) [(A & C) == D]: Remove
> transformation.
> * match.pd (X == C): Rewrite it here.
> (with_possible_nonzero_bits, with_possible_nonzero_bits2,
> with_certain_nonzero_bits2): New predicates.
> * tree-ssanames.c (get_nonzero_bits): Handle INTEGER_CST.
>
> --
> Marc Glisse