[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] target-mips: Fix incorrect shift for SHILO a
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2] target-mips: Fix incorrect shift for SHILO and SHILOV |
Date: |
Wed, 5 Dec 2012 16:38:22 +0000 |
On 5 December 2012 15:51, Richard Henderson <address@hidden> wrote:
> On 2012-12-05 09:49, Peter Maydell wrote:
>> On 5 December 2012 15:36, Richard Henderson <address@hidden> wrote:
>>> On 2012-12-04 17:29, Petar Jovanovic wrote:
>>>> rs5_0 = (int8_t)(rs5_0 << 2) >> 2;
>>>
>>> This is more portably written as
>>>
>>> rs5_0 = (rs5_0 ^ 0x20) - 0x20;
>>
>> ...but way more obscurely. If we want to play that
>> kind of game can we have a sign-extension function in
>> a header somewhere?
>
> I dunno about more obscurely. It took me a minute to figure out
> what was wanted in the original.
>
> As for a helper function... sure.
I don't think we should block this patch on that general
cleanup, though. All the sign extensions in target-mips/translate.c
are done in the double-shift way, so this is consistent with
the existing code.
-- PMM
Re: [Qemu-devel] [PATCH v2] target-mips: Fix incorrect shift for SHILO and SHILOV, Johnson, Eric, 2012/12/05
Re: [Qemu-devel] [PATCH v2] target-mips: Fix incorrect shift for SHILO and SHILOV, Aurelien Jarno, 2012/12/06