This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR middle-end/19055, (X | Y) ^ X -> Y & ~X
- From: Jeffrey A Law <law at redhat dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 Jul 2005 11:07:19 -0600
- Subject: Re: [PATCH] PR middle-end/19055, (X | Y) ^ X -> Y & ~X
- References: <f79ebe5e06018f10bb0f5f164a1b60e0@physics.uc.edu>
- Reply-to: law at redhat dot com
On Tue, 2005-07-05 at 09:52 -0400, Andrew Pinski wrote:
> This patch implements a small bit optimization in fold which will help
> targets with a instruction for andc (X & ~ Y) and should not hurt
> targets
> which don't have it and that many registers. On X86 if X and Y are not
> used
> afterwards, we actually save 2 bytes in code size. If they are used,
> there
> is no loss.
>
> OK? Bootstrapped and tested on powerpc-darwin with no regressions.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * fold-const.c (fold_binary): Transform "(X | Y) ^ X" to "Y & ~ X".
>
> testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/pr19055.c: New test.
> * gcc.dg/tree-ssa/pr19055-2.c: New test.
OK for mainline.
jeff