qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [PATCH 5/7] tcg-i386: Implement deposit operation.


From: Richard Henderson
Subject: Re: [Qemu-devel] Re: [PATCH 5/7] tcg-i386: Implement deposit operation.
Date: Sun, 09 Jan 2011 14:55:13 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7

On 01/09/2011 01:53 PM, Aurelien Jarno wrote:
>> +    if (inout == val) {
>> +        TCGType type = rexw ? TCG_TYPE_I64 : TCG_TYPE_I32;
>> +        TCGRegSet inuse = s->reserved_regs;
>> +
>> +        tcg_regset_set_reg(inuse, inout);
>> +        val = tcg_reg_alloc(s, tcg_target_available_regs[type], inuse);
>> +
>> +        tcg_out_mov(s, type, val, inout);
> 
> I am a bit worried by allocating a new register here, especially on the
> i386 target, where the number of free registers is quite low, and often
> 0. We already had to tweak some code to avoid calls to tcg_abort() due
> to missing registers.

Well, as I said, this case can't actually trigger due to a bug in the
register allocator.  This can be seen in an insn like

        mov     %dl,%dh

where you would expect to see

        deposit x,x,x,8,8

however, the matching constraint forces the destination and the matching
source into a new register:

                /* if the input is aliased to an output and if it is
                   not dead after the instruction, we must allocate
                   a new register and move it */
                if (!IS_DEAD_IARG(i - nb_oargs)) 
                    goto allocate_in_reg;

which means that we'll always see

        mov     y,x
        deposit y,y,x,8,8

So I could simply put a tcg_abort there.  It would be up to whoever
improves the register allocator to provide some mechanism for a
backend to allocate a scratch.  What do you think?


r~



reply via email to

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