From patchwork Thu Jan 24 04:03:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 215251 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 CD7822C0080 for ; Thu, 24 Jan 2013 16:47:46 +1100 (EST) Received: from localhost ([::1]:37235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE56-0004rW-NA for incoming@patchwork.ozlabs.org; Wed, 23 Jan 2013 23:06:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE36-0001uF-U7 for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyE2w-0004Hm-67 for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:24 -0500 Received: from mail-da0-f48.google.com ([209.85.210.48]:35139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE2v-0004Hb-TB for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:04:14 -0500 Received: by mail-da0-f48.google.com with SMTP id k18so4070421dae.7 for ; Wed, 23 Jan 2013 20:04:13 -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=wNYq6KiMheWEB9mqj2NDmCfwYiUoc5Pc5k2i+Ge7VeA=; b=n+JZ6kG8gj3m3QdAuqlN/obfC+mhkSaUOXMJpWbDzfjB4Dyz/QLwiBLT7H4WUfu7w8 QCq505Gv72rbzzA14PMxyEM+jDE59m7y/CKIGG97cn83Az99u3vVEv5ti2RXsiRfig2J C3mdG5I5Ur5dwQ/YS5yY4usIbevI+igGvjT3x23UdrKT0gyiOGhNN+Qeahg+ERkv2oVQ FVbMm0d7wvm6ECuMWht8sRdcyObV+QYeRb/PFMB3WaarM0F9Gm0X0HW76v0OY3eUihvM hK84rHaCRHU4fEXJ/Ya6JRTVkKOOi9i//ZMI4n7JQv0sEwQBoQ4EYo6N7URxhQ/lFTKm NwMQ== X-Received: by 10.68.236.2 with SMTP id uq2mr1441718pbc.55.1359000252943; Wed, 23 Jan 2013 20:04:12 -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.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Jan 2013 20:04:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 23 Jan 2013 20:03:01 -0800 Message-Id: <1359000221-19834-18-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.210.48 Cc: Blue Swirl , Paolo Bonzini Subject: [Qemu-devel] [PATCH 17/57] target-i386: add helper functions to get other flags 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 From: Paolo Bonzini Introduce new functions to extract PF, SF, OF, ZF in addition to CF. These provide single entry points for optimizing accesses to a single flag. Reviewed-by: Blue Swirl Signed-off-by: Paolo Bonzini Signed-off-by: Richard Henderson --- target-i386/translate.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index 956765a..17e6c1a 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -857,21 +857,49 @@ static void gen_compute_eflags(DisasContext *s, TCGv reg) tcg_gen_extu_i32_tl(reg, cpu_tmp2_i32); } +/* compute eflags.P to reg */ +static void gen_compute_eflags_p(DisasContext *s, TCGv reg) +{ + gen_compute_eflags(s, reg); + tcg_gen_shri_tl(reg, reg, 2); + tcg_gen_andi_tl(reg, reg, 1); +} + +/* compute eflags.S to reg */ +static void gen_compute_eflags_s(DisasContext *s, TCGv reg) +{ + gen_compute_eflags(s, reg); + tcg_gen_shri_tl(reg, reg, 7); + tcg_gen_andi_tl(reg, reg, 1); +} + +/* compute eflags.O to reg */ +static void gen_compute_eflags_o(DisasContext *s, TCGv reg) +{ + gen_compute_eflags(s, reg); + tcg_gen_shri_tl(reg, reg, 11); + tcg_gen_andi_tl(reg, reg, 1); +} + +/* compute eflags.Z to reg */ +static void gen_compute_eflags_z(DisasContext *s, TCGv reg) +{ + gen_compute_eflags(s, reg); + tcg_gen_shri_tl(reg, reg, 6); + tcg_gen_andi_tl(reg, reg, 1); +} + static inline void gen_setcc_slow_T0(DisasContext *s, int jcc_op) { switch(jcc_op) { case JCC_O: - gen_compute_eflags(s, cpu_T[0]); - tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 11); - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 1); + gen_compute_eflags_o(s, cpu_T[0]); break; case JCC_B: gen_compute_eflags_c(s, cpu_T[0]); break; case JCC_Z: - gen_compute_eflags(s, cpu_T[0]); - tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 6); - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 1); + gen_compute_eflags_z(s, cpu_T[0]); break; case JCC_BE: gen_compute_eflags(s, cpu_tmp0); @@ -880,14 +908,10 @@ static inline void gen_setcc_slow_T0(DisasContext *s, int jcc_op) tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 1); break; case JCC_S: - gen_compute_eflags(s, cpu_T[0]); - tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 7); - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 1); + gen_compute_eflags_s(s, cpu_T[0]); break; case JCC_P: - gen_compute_eflags(s, cpu_T[0]); - tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 2); - tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 1); + gen_compute_eflags_p(s, cpu_T[0]); break; case JCC_L: gen_compute_eflags(s, cpu_tmp0);