qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 08/10 v11] target-tilegx: Add several helpers fo


From: Chen Gang
Subject: Re: [Qemu-devel] [PATCH 08/10 v11] target-tilegx: Add several helpers for instructions translation
Date: Tue, 2 Jun 2015 02:47:42 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 6/2/15 00:02, Richard Henderson wrote:
> On 05/30/2015 02:17 PM, Chen Gang wrote:
>> +    for (count = 0; count < 8; count++) {
>> +        sel = (rsrcb >> (count * 8)) & 0xf;
>> +        if (sel < 8) {
>> +            vdst |= ((rdst >> (8 * sel)) & 0xff) << (count * 8);
>> +        } else {
>> +            vdst |= ((rsrc >> (8 * (8 - sel))) & 0xff) << (count * 8);
> 
> 8 - sel is wrong; you wanted sel - 8.
> 

OK, thank you very much.

> That said, you can do better with masking operations.  And for brevity, let
> count increment by 8.  E.g.
> 
>   uint64_t vdst = 0;
>   int count;
> 
>   for (count = 0; count < 64; count += 8) {
>     uint64_t sel = rsrcb >> count;
>     uint64_t src = (sel & 8 ? rsrc : rdst);
>     vdst |= ((src >> ((sel & 7) * 8)) & 0xff) << count;
>   }
> 

OK, thank.

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]