qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4
Date: Sun, 20 Dec 2009 18:00:48 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Thunderbird/3.0

On 12/20/2009 02:57 PM, Paul Brook wrote:
On Saturday 19 December 2009, Richard Henderson wrote:
Changes from round 3:

  * Drop movcond for now.
  * Only use movzbl and not xor in setcond.

I'm still catching up on mail backlog from this thread, but I'm concerned that
we're exposing setcond to the target translation code if we're planning on
implementing movcond later.

I personally was only planning to use setcond in those cases where the target actually wants a 0/1 value. E.g. i386 setcc, or alpha cmp*, or mips slt*.

As for shifts and masks, that wasn't in my plans. I had a comment in there about all the tricks that gcc plays with a conditional move of two constants, and the fact that I didn't think it worth the effort.

Indeed, my plan for today was to cut down my existing movcond patch to make it simpler, as that seems to be the way Aurelien wants this to go. Life conspired against and I got nothing done, but still.

I *am* convinced that to remove either VTRUE or VFALSE as arguments to the movcond primitive (implementing dest = (cond ? vtrue : dest) would do too much violence to both the liveness analysis and the register allocator within TCG. The best I can do to remove the complexity is:

static void tcg_out_movcond(TCGContext *s, int cond, TCGArg dest,
                            TCGArg cmp1, TCGArg cmp2, int const_cmp2,
                            TCGArg vtrue, int rexw)
{
    tcg_out_cmp(s, cond, cmp1, cmp2, const_cmp2, rexw);
    /* cmovcc */
    tcg_out_modrm(s, 0x40 | tcg_cond_to_jcc[cond] | P_EXT | rexw,
                  dest, vtrue);
}
...
    { INDEX_op_movcond_i32, { "r", "r", "ri", "r", "0" } },
    { INDEX_op_movcond_i64, { "r", "r", "re", "r", "0" } },

using matching constraints in the target and directly implement the conditional move. This eliminates the code I previously had that checked for things like dest=vfalse and inverted the condition. I had planned to simplify the i386 version similarly, even in the case where cmovcc is not available.

I would appreciate some direction here, so as to avoid wasting my time with a solution that won't be accepted.


r~




reply via email to

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