qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.13] tcg: Improve TCGv_ptr support


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH for-2.13] tcg: Improve TCGv_ptr support
Date: Thu, 19 Apr 2018 18:41:04 +0100

On 19 April 2018 at 11:30, Peter Maydell <address@hidden> wrote:
> 2018-04-17 23:26 GMT+01:00 Richard Henderson <address@hidden>:
>> Drop TCGV_PTR_TO_NAT and TCGV_NAT_TO_PTR internal macros.
>>
>> Add tcg_temp_local_new_ptr, tcg_gen_brcondi_ptr, tcg_gen_ext_i32_ptr,
>> tcg_gen_trunc_i64_ptr, tcg_gen_extu_ptr_i64, tcg_gen_trunc_ptr_i32.
>>
>> Use inlines instead of macros where possible.
>>
>> Signed-off-by: Richard Henderson <address@hidden>
>> ----
>>
>> These additions will be used by target/arm/translate-sve.c.
>
>> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
>> index c532889b1f..cdc397308b 100644
>> --- a/target/hppa/translate.c
>> +++ b/target/hppa/translate.c
>
>> @@ -251,13 +245,7 @@
>>  #define tcg_gen_qemu_ld_reg  tcg_gen_qemu_ld_i32
>>  #define tcg_gen_qemu_st_reg  tcg_gen_qemu_st_i32
>>  #define tcg_gen_atomic_xchg_reg tcg_gen_atomic_xchg_i32
>> -#if UINTPTR_MAX == UINT32_MAX
>> -# define tcg_gen_trunc_reg_ptr(p, r) \
>> -    tcg_gen_mov_i32(TCGV_PTR_TO_NAT(p), r)
>> -#else
>> -# define tcg_gen_trunc_reg_ptr(p, r) \
>> -    tcg_gen_extu_i32_i64(TCGV_PTR_TO_NAT(p), r)
>> -#endif
>> +#define tcg_gen_trunc_reg_ptr   tcg_gen_ext_i32_ptr
>
> For the 64-bit host case, this used to be an unsigned
> 32->64 extension, but now it is a sign extension.

Ah, looking at the code we only use this in one place:
    tcg_gen_shri_reg(tmp, base, TARGET_REGISTER_BITS - 5);
    tcg_gen_andi_reg(tmp, tmp, 030);
    tcg_gen_trunc_reg_ptr(ptr, tmp);

and the AND-immediate means we know the high bit of tmp
must be zero, so signed vs unsigned extension makes no difference.

So
Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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