From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMXZs-0006m3-S6 for qemu-devel@nongnu.org; Sun, 20 Dec 2009 21:00:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMXZs-0006li-14 for qemu-devel@nongnu.org; Sun, 20 Dec 2009 21:00:52 -0500 Received: from [199.232.76.173] (port=43239 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMXZr-0006lf-SB for qemu-devel@nongnu.org; Sun, 20 Dec 2009 21:00:51 -0500 Received: from are.twiddle.net ([75.149.56.221]:59449) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMXZr-0000Gw-Bx for qemu-devel@nongnu.org; Sun, 20 Dec 2009 21:00:51 -0500 Message-ID: <4B2ED6D0.1010900@twiddle.net> Date: Sun, 20 Dec 2009 18:00:48 -0800 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4 References: <200912202257.22503.paul@codesourcery.com> In-Reply-To: <200912202257.22503.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org, aurelien@aurel32.net 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~