On Wed, Nov 14, 2012 at 11:27 AM, Steve Ellcey <sell...@mips.com> wrote:
> 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.

I know exactly where this code comes from; I have looked at the
benchmark as one of the reason why I add expand_cond_expr_using_cmove
in the first place.  Anyways you should look into removing
TARGET_PROMOTE_PROTOTYPES because I found that also fixes the problem
mentioned here.

Thanks,
Andrew Pinski

>
> Steve Ellcey
> sell...@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;
> }
>

Reply via email to