qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH for-1.1 0/3] tcg/ppc: AREG0 support a


From: Andreas Färber
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH for-1.1 0/3] tcg/ppc: AREG0 support and Darwin fixes
Date: Tue, 08 May 2012 22:25:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

Am 08.05.2012 21:42, schrieb Alexander Graf:
> 
> On 08.05.2012, at 21:29, Andreas Färber wrote:
> 
>> On patch 3/3 he didn't like my alignment macro. I don't have a better
>> one though, suggestions or patches welcome. Ideal might be some
>> ROUND_TO_ODD() macro, but the problem is that for Darwin/AIX where it's
>> no-op it shouldn't result in a "statement without effect" warning.
>> Therefore my do { } while (0) as opposed to ir = MACRO(ir).
> 
> static inline int round_reg_i64(int input_reg)
> {
> #ifdef WHATEVER_CONDITION
>     if (input_reg % 2) {
>         reg++;
>     }
> #endif
> 
>     return reg;
> }
> 
> [...]
> 
>   ir = round_reg_i64(ir);

I think he didn't like the mod check either but the suggestion
<malc> [...] reg += reg & TCG_TARGET_CALL_ALIGN_ARGS [...]
doesn't work well when TCG_TARGET_CALL_ALIGN_ARGS is undefined.
And defining it with value 0 seems unsafe to me.

What about the following? (untested)

static inline int tcg_target_call_align_i64_reg(int reg)
{
#ifdef TCG_TARGET_CALL_ALIGN_ARGS
    /* Round up to next odd register */
    return (reg & ~1) + 1;
#else
    return reg;
#endif
}

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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