This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: match.pd: Optimize (x & y) ^ (x | y)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Thu, 11 Jun 2015 13:09:05 +0200
- Subject: Re: match.pd: Optimize (x & y) ^ (x | y)
- Authentication-results: sourceware.org; auth=none
- References: <20150611110432 dot GY2756 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jun 11, 2015 at 01:04:32PM +0200, Marek Polacek wrote:
> This patch introduces a new pattern for the match-and-simplify
> machinery.
>
> I have verified this transformation on a toy testcase (tried x and y
> in the range [-1000,1000]) and it does a correct thing for all integers.
>
> The asm diff for fn1 is
> - andl %esi, %eax
> - orl %edi, %esi
> so clearly a win.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
What about some nop type conversions in between?
int
fn1 (unsigned int x, unsigned int y)
{
int a = x;
int b = y;
unsigned int c = x & y;
int d = a | b;
return (int) (c ^ d);
}
? Also wonder, if some testcases for match.pd shouldn't be
in separate statements so that they don't test the GENERIC folding,
but GIMPLE folding.
Jakub