From patchwork Tue Feb 19 17:40:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 221886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 08E482C0291 for ; Wed, 20 Feb 2013 07:54:08 +1100 (EST) Received: from localhost ([::1]:37118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7uCT-0006Cq-Pa for incoming@patchwork.ozlabs.org; Tue, 19 Feb 2013 15:54:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7rTL-00018h-Dg for qemu-devel@nongnu.org; Tue, 19 Feb 2013 12:59:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7rCG-0008BP-So for qemu-devel@nongnu.org; Tue, 19 Feb 2013 12:42:02 -0500 Received: from mail-pb0-f49.google.com ([209.85.160.49]:41780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7rCG-0008B6-KZ for qemu-devel@nongnu.org; Tue, 19 Feb 2013 12:41:40 -0500 Received: by mail-pb0-f49.google.com with SMTP id xa12so2376085pbc.36 for ; Tue, 19 Feb 2013 09:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=tfQGPvDAWG65imO1zWfQK9Ep4fCph2hEaDv7xqu655c=; b=QPnYVNcCNAUinOy1uHtxNOUj6StysKNCP47FE/1sJD+CT8lhsmN1URZU6tTyqCdPZk l6oE+L3FPgeRajo1GUbA25+iTecw1tsh2YHtkiPdHVNgurVZWar2Tk8G6NmlopamVJK3 rHIKaoheKnpFZa8IDogwTP+cdB9jHrYGxIrDNMjQdzHJXGs1KzJudQP46ngxjVVlR71D flgqyKTuO0KiTOwn9YfIXwqcLjyOEIkKVR5o7/fV+Zk0g9eOt/I1IsI4moKD+II2lf9Z fcSiTu7XIC3dalDwdHL/42QQorUyg8g44kTOVNJPFrIZVgfs/p5dLS70z+sVwUvWel+t Hudw== X-Received: by 10.66.85.73 with SMTP id f9mr47708815paz.13.1361295699899; Tue, 19 Feb 2013 09:41:39 -0800 (PST) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id 1sm18659295pbg.18.2013.02.19.09.41.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 19 Feb 2013 09:41:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 19 Feb 2013 09:40:08 -0800 Message-Id: <1361295631-21316-35-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1361295631-21316-1-git-send-email-rth@twiddle.net> References: <1361295631-21316-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.49 Cc: blauwirbel@gmail.com, pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 34/57] target-i386: expand cmov via movcond X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Richard Henderson --- target-i386/translate.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index 4b0a701..9d5467d 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -2417,35 +2417,30 @@ static inline void gen_jcc(DisasContext *s, int b, static void gen_cmovcc1(CPUX86State *env, DisasContext *s, int ot, int b, int modrm, int reg) { - int l1, mod = (modrm >> 6) & 3; - TCGv t0 = tcg_temp_local_new(); + CCPrepare cc; - if (mod != 3) { - int reg_addr, offset_addr; - gen_lea_modrm(env, s, modrm, ®_addr, &offset_addr); - gen_op_ld_v(ot + s->mem_index, t0, cpu_A0); - } else { - int rm = (modrm & 7) | REX_B(s); - gen_op_mov_v_reg(ot, t0, rm); - } + gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); - l1 = gen_new_label(); - gen_jcc1(s, b ^ 1, l1); - switch (ot) { -#ifdef TARGET_X86_64 - case OT_LONG: - tcg_gen_mov_tl(cpu_regs[reg], t0); - gen_set_label(l1); - tcg_gen_ext32u_tl(cpu_regs[reg], cpu_regs[reg]); - break; -#endif - default: - gen_op_mov_reg_v(ot, reg, t0); - gen_set_label(l1); - break; + cc = gen_prepare_cc(s, b, cpu_T[1]); + if (cc.mask != -1) { + TCGv t0 = tcg_temp_new(); + tcg_gen_andi_tl(t0, cc.reg, cc.mask); + cc.reg = t0; + } + if (!cc.use_reg2) { + cc.reg2 = tcg_const_tl(cc.imm); } - tcg_temp_free(t0); + tcg_gen_movcond_tl(cc.cond, cpu_T[0], cc.reg, cc.reg2, + cpu_T[0], cpu_regs[reg]); + gen_op_mov_reg_T0(ot, reg); + + if (cc.mask != -1) { + tcg_temp_free(cc.reg); + } + if (!cc.use_reg2) { + tcg_temp_free(cc.reg2); + } } static inline void gen_op_movl_T0_seg(int seg_reg)