From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMsCk-0005Ui-SH for qemu-devel@nongnu.org; Mon, 21 Dec 2009 19:02:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMsCj-0005UL-SB for qemu-devel@nongnu.org; Mon, 21 Dec 2009 19:02:21 -0500 Received: from [199.232.76.173] (port=43912 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMsCj-0005UI-No for qemu-devel@nongnu.org; Mon, 21 Dec 2009 19:02:21 -0500 Received: from are.twiddle.net ([75.149.56.221]:56628) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMsCj-0008E8-7L for qemu-devel@nongnu.org; Mon, 21 Dec 2009 19:02:21 -0500 Message-ID: <4B300C8A.2030706@twiddle.net> Date: Mon, 21 Dec 2009 16:02:18 -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> <4B2ED6D0.1010900@twiddle.net> <761ea48b0912210113p42608776q7677f79eec83f5a6@mail.gmail.com> <4B2FDA53.6040605@twiddle.net> <761ea48b0912211421y2e213dc0gfed24835f3b7f658@mail.gmail.com> <4B2FFBA3.4060601@twiddle.net> <761ea48b0912211508i481286b8gcb78c34afb4e26ea@mail.gmail.com> In-Reply-To: <761ea48b0912211508i481286b8gcb78c34afb4e26ea@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: Paul Brook , aurelien@aurel32.net, qemu-devel@nongnu.org On 12/21/2009 03:08 PM, Laurent Desnogues wrote: > If you wanted to use movcond, you'd have to make > cond + move a special case... You'd certainly want the ARM front-end to use movcond more often than that. For instance: addeq r1,r2,r3 --> add_i32 tmp,r2,r3 movcond_i32 r1,ZF,0,tmp,r1,eq You'd want to continue to use a branch around if the instruction has side effects like cpu fault (e.g. load, store) or updating flags. It ought not be very hard to arrange for something like if (cond != 0xe) { if (may_use_movcond(insn)) { s->condlabel = -1; /* Save the true destination register. */ s->conddest = cpu_R[dest]; /* Implement the instruction into a temporary. */ cpu_R[dest] = tcg_temp_new(); } else { s->condlabel = gen_new_label(); ArmConditional cmp = gen_test_cc(cond ^ 1); tcg_gen_brcondi_i32(cmp.cond, cmp.reg, 0, s->condlabel); } s->condjmp = 1; } // ... implement the instruction as we currently do. if (s->condjmp) { if (s->condlabel == -1) { /* Conditionally move the temporary result into the true destination register. */ ArmConditional cmp = gen_test_cc(cond); tcg_gen_movcond_i32(cmp.cond, s->conddest, cmp.reg, 0, cpu_R[dest], s->conddest); tcg_temp_free(cpu_R[dest]); /* Restore the true destination register. */ cpu_R[dest] = s->conddest; } else { tcg_set_label(d->condlabel); } } r~