From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFBbF-0000aI-6V for qemu-devel@nongnu.org; Fri, 21 Sep 2012 18:21:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFBbE-0005Ap-9S for qemu-devel@nongnu.org; Fri, 21 Sep 2012 18:21:29 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:35029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFBbD-0005Ah-RE for qemu-devel@nongnu.org; Fri, 21 Sep 2012 18:21:28 -0400 Received: by pbbrp12 with SMTP id rp12so8597717pbb.4 for ; Fri, 21 Sep 2012 15:21:27 -0700 (PDT) Sender: Richard Henderson Message-ID: <505CE864.1050701@twiddle.net> Date: Fri, 21 Sep 2012 15:21:24 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1348247620-12734-1-git-send-email-rth@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 0/7] tcg: movcond (ppc32 version) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org, Aurelien Jarno On 09/21/2012 01:10 PM, malc wrote: > + if (dest == v2) { > + label_ptr = s->code_ptr; > + tcg_out32 (s, tcg_to_bc[tcg_invert_cond (cond)]); > + tcg_out_mov (s, TCG_TYPE_I32, dest, v1); > + reloc_pc14 (label_ptr, (tcg_target_long) s->code_ptr); > + } > + else { > + tcg_out_mov (s, TCG_TYPE_I32, dest, v1); > + label_ptr = s->code_ptr; > + tcg_out32 (s, tcg_to_bc[cond]); > + tcg_out_mov (s, TCG_TYPE_I32, dest, v2); > + reloc_pc14 (label_ptr, (tcg_target_long) s->code_ptr); > + } How about if (dest == v2) { cond = tcg_invert_cond(cond); v2 = v1; } else if (dest != v1) { tcg_out_mov(s, TCG_TYPE_I32, dest, v1); } /* Branch forward over one insn. */ tcg_out32 (s, tcg_to_bc[cond] | 4); tcg_out_mov(s, TCG_TYPE_I32, dest, v2); which avoids an extra mov if dest == v1, and also minimizes the code. r~