From patchwork Thu Jan 24 04:02:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 215220 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 2D8822C0040 for ; Thu, 24 Jan 2013 15:54:37 +1100 (EST) Received: from localhost ([::1]:36401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE4r-0004Pv-8o for incoming@patchwork.ozlabs.org; Wed, 23 Jan 2013 23:06:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE31-0001fE-BU for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyE2s-0004GY-LG for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:19 -0500 Received: from mail-pb0-f43.google.com ([209.85.160.43]:54993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE2s-0004GC-9V for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:10 -0500 Received: by mail-pb0-f43.google.com with SMTP id jt11so3760865pbb.2 for ; Wed, 23 Jan 2013 20:04:09 -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=ogs+OjFhkAneFzzuc3R2BUTSxErDVbscjq75nSiUPac=; b=Owj6ZbWu1P5jzbD0Z2DgG0lM1/U6CMAkTR4HL43rt1Hf1Z8wOOYsI6Rh3Bwe/2eM4x 7+1x+eSTfCR3hVpV50danTkGZkGzQi9nFG5Pu+xxeGHJbpIgiDE8gFD0vavgH8cR7qrJ tk7iWThCCH6ALkwFodKLaWkCaw136q3Y272OT3Xg5FVMOWurjK1BbuA+HVeTTEA9EfzZ bj9AL6cjX5VU4przqC1yhNYlTkNDm172yYUmLk/ivR0N/YgglBvcZiW2peA8hxXyPYjw AGdlXXYxLdxknf7Hjcw8HnxzsgqBH1TwfHBS7XIoEo4j1ZLpPiD7O9U/CKgOGsStIwwK UUxw== X-Received: by 10.68.252.69 with SMTP id zq5mr1362484pbc.104.1359000249573; Wed, 23 Jan 2013 20:04:09 -0800 (PST) Received: from anchor.twiddle.home (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id ot3sm14027480pbb.38.2013.01.23.20.04.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Jan 2013 20:04:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 23 Jan 2013 20:02:59 -0800 Message-Id: <1359000221-19834-16-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359000221-19834-1-git-send-email-rth@twiddle.net> References: <1359000221-19834-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.43 Cc: Blue Swirl , Paolo Bonzini Subject: [Qemu-devel] [PATCH 15/57] target-i386: Don't clobber s->cc_op in gen_update_cc_op 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 Use a dirty flag to know whether env->cc_op is up to date, rather than forcing s->cc_op to DYNAMIC and losing info. Signed-off-by: Richard Henderson --- target-i386/translate.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index 88781dc..43b24d7 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -90,6 +90,7 @@ typedef struct DisasContext { #endif int ss32; /* 32 bit stack segment */ CCOp cc_op; /* current CC operation */ + bool cc_op_dirty; int addseg; /* non zero if either DS/ES/SS have a non zero base */ int f_st; /* currently unused */ int vm86; /* vm86 mode */ @@ -173,9 +174,27 @@ enum { OR_A0, /* temporary register used when doing address evaluation */ }; -static inline void set_cc_op(DisasContext *s, CCOp op) +static void set_cc_op(DisasContext *s, CCOp op) { - s->cc_op = op; + if (s->cc_op != op) { + s->cc_op = op; + /* The DYNAMIC setting is translator only, and should never be + stored. Thus we always consider it clean. */ + s->cc_op_dirty = (op != CC_OP_DYNAMIC); + } +} + +static inline void gen_op_set_cc_op(int32_t val) +{ + tcg_gen_movi_i32(cpu_cc_op, val); +} + +static void gen_update_cc_op(DisasContext *s) +{ + if (s->cc_op_dirty) { + gen_op_set_cc_op(s->cc_op); + s->cc_op_dirty = false; + } } static inline void gen_op_movl_T0_0(void) @@ -444,11 +463,6 @@ static inline void gen_op_add_reg_T0(int size, int reg) } } -static inline void gen_op_set_cc_op(int32_t val) -{ - tcg_gen_movi_i32(cpu_cc_op, val); -} - static inline void gen_op_addl_A0_reg_sN(int shift, int reg) { tcg_gen_mov_tl(cpu_tmp0, cpu_regs[reg]); @@ -800,14 +814,6 @@ static inline void gen_movs(DisasContext *s, int ot) gen_op_add_reg_T0(s->aflag, R_EDI); } -static inline void gen_update_cc_op(DisasContext *s) -{ - if (s->cc_op != CC_OP_DYNAMIC) { - gen_op_set_cc_op(s->cc_op); - set_cc_op(s, CC_OP_DYNAMIC); - } -} - static void gen_op_update1_cc(void) { tcg_gen_discard_tl(cpu_cc_src); @@ -7816,6 +7822,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, dc->tf = (flags >> TF_SHIFT) & 1; dc->singlestep_enabled = env->singlestep_enabled; dc->cc_op = CC_OP_DYNAMIC; + dc->cc_op_dirty = false; dc->cs_base = cs_base; dc->tb = tb; dc->popl_esp_hack = 0;