This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: match.pd: Three new patterns
- From: Marek Polacek <polacek at redhat dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Thu, 18 Jun 2015 17:41:18 +0200
- Subject: Re: match.pd: Three new patterns
- Authentication-results: sourceware.org; auth=none
- References: <20150612121332 dot GH2756 at redhat dot com> <alpine dot DEB dot 2 dot 20 dot 1506131138460 dot 2373 at laptop-mg dot saclay dot inria dot fr>
On Sat, Jun 13, 2015 at 12:05:42PM +0200, Marc Glisse wrote:
> They look fine to me.
Thanks!
> >+/* (x & y) + (x ^ y) -> x | y */
>
> This also works if you replace + with | or ^.
Done.
> >+/* (x | y) - (x ^ y) -> x & y */
>
> For symmetry, you probably also want:
> (x | y) - (x & y) -> x ^ y
Done.
> (they both also work with ^ instead of -)
Done (except (x & y) ^ (x | y) -> x ^ y which we already have).
> >+/* (x & y) + (x | y) -> x + y */
>
> Again for symmetry, it seems like this comes with
> x + y - (x | y) -> x & y
> x + y - (x & y) -> x | y
> which seem fine when overflow is undefined or wraps, but not if for instance
> it saturates.
I'll leave this as a follow-up.
Testing a new patch. Thanks again.
Marek