[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] target-tilegx: Implement v*add and v*sub instru
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] target-tilegx: Implement v*add and v*sub instructions |
Date: |
Tue, 22 Sep 2015 07:45:27 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 09/21/2015 10:54 PM, Chen Gang wrote:
> On 2015年09月19日 10:34, Richard Henderson wrote:
>>
>> There's a trick for this that's more efficient for 4 or more elements
>> per vector (i.e. good for v2 and v1, but not v4):
>>
>> a + b = (a & 0x7f7f7f7f) + (b & 0x7f7f7f7f)) ^ ((a ^ b) & 0x80808080)
>>
>> a - b = (a | 0x80808080) - (b & 0x7f7f7f7f)) ^ ((a ^ ~b) & 0x80808080)
>>
>
> For me, we need use "(a ^ b) & 0x80..." instead of "(a ^ ~b) & 0x80...".
No. What you did wrong was not use (a | 0x80808080).
r~