qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/26] tcg-aarch64: Use adrp in tcg_out_movi


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 07/26] tcg-aarch64: Use adrp in tcg_out_movi
Date: Mon, 24 Mar 2014 08:36:59 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 03/24/2014 07:05 AM, Claudio Fontana wrote:
>> > +    /* Look for host pointer values within 4G of the PC.  This happens
>> > +       often when loading pointers to QEMU's own data structures.  */
>> > +    disp = (value >> 12) - ((intptr_t)s->code_ptr >> 12);
>> > +    if (disp == sextract64(disp, 0, 21)) {
>
> nit.. for the check to be correct in all cases, the assumption here is that
> intptr_t is the same size as a signed target long; would a cast to
> tcg_target_long instead of intptr_t be "safer"?
> 

I don't think so.

Gcc 4.9 supports an -m32 abi for aarch64.  Suppose we were to compile qemu this
way.  In that case tcg_target_long would be larger than intptr_t, and the cast
here would Werror.  But leaving it intptr_t, we get a proper sign-extension
with type promotion to tcg_target_long, and the arithmetic will in fact work
like expected.


r~



reply via email to

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