This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: match.pd: Three new patterns


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]