This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Performance patch for MIPS conditional move in expr.c
On Wed, 2012-11-14 at 11:15 -0800, Andrew Pinski wrote:
> Do you have a testcase? As I added expand_cond_expr_using_cmove, I
> think this is the correct fix.
>
> Thanks,
> Andrew Pinski
Here is a cutdown test case that I have been compiling with -O3, if you
compare with and without my patch you will see fewer 'andi' instructions
with 0xffff are generated after my patch is applied.
Steve Ellcey
sellcey@mips.com
unsigned short foo(unsigned short a1, unsigned short a2)
{
unsigned short i, x;
for (i = 0; i < 8; i++) {
x = (a1 & 1) ^ (a2 & 1);
a1 >>= 1;
if (x == 1) a2 ^= 0x2006;
a2 >>= 1;
if (x == 1) a2 |= 0x8800;
else a2 &= 0x77ff;
}
return a2;
}