From patchwork Mon Mar 1 21:33:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 46613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D17EB7DA1 for ; Tue, 2 Mar 2010 08:49:00 +1100 (EST) Received: from localhost ([127.0.0.1]:45365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmDPh-00015U-Kb for incoming@patchwork.ozlabs.org; Mon, 01 Mar 2010 16:44:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmDG7-0003wB-Q1 for qemu-devel@nongnu.org; Mon, 01 Mar 2010 16:34:35 -0500 Received: from [199.232.76.173] (port=54289 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmDG7-0003vD-35 for qemu-devel@nongnu.org; Mon, 01 Mar 2010 16:34:35 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmDG5-0000yV-Re for qemu-devel@nongnu.org; Mon, 01 Mar 2010 16:34:34 -0500 Received: from hall.aurel32.net ([88.191.82.174]:41346) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NmDG4-0000xt-RS for qemu-devel@nongnu.org; Mon, 01 Mar 2010 16:34:33 -0500 Received: from [2a01:e35:2e80:2fb0:21e:8cff:feb0:693b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NmDG2-0007f6-T2; Mon, 01 Mar 2010 22:34:30 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.71) (envelope-from ) id 1NmDFy-0000ie-1x; Mon, 01 Mar 2010 22:34:26 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Mon, 1 Mar 2010 22:33:50 +0100 Message-Id: <1267479230-1964-5-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267479230-1964-1-git-send-email-aurelien@aurel32.net> References: <1267479230-1964-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Andrzej Zaborowski , Aurelien Jarno Subject: [Qemu-devel] [PATCH 4/4] tcg/arm: accept immediate arguments for brcond/setcond X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Aurelien Jarno --- tcg/arm/tcg-target.c | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index d743dbc..63f84c3 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -1512,8 +1512,15 @@ static inline void tcg_out_op(TCGContext *s, int opc, break; case INDEX_op_brcond_i32: - tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, - args[0], args[1], SHIFT_IMM_LSL(0)); + if (const_args[1]) { + int rot; + rot = encode_imm(args[1]); + tcg_out_dat_imm(s, COND_AL, ARITH_CMP, + 0, args[0], rotl(args[1], rot) | (rot << 7)); + } else { + tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, + args[0], args[1], SHIFT_IMM_LSL(0)); + } tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[2]], args[3]); break; case INDEX_op_brcond2_i32: @@ -1532,8 +1539,15 @@ static inline void tcg_out_op(TCGContext *s, int opc, tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[4]], args[5]); break; case INDEX_op_setcond_i32: - tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, - args[1], args[2], SHIFT_IMM_LSL(0)); + if (const_args[2]) { + int rot; + rot = encode_imm(args[2]); + tcg_out_dat_imm(s, COND_AL, ARITH_CMP, + 0, args[1], rotl(args[2], rot) | (rot << 7)); + } else { + tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, + args[1], args[2], SHIFT_IMM_LSL(0)); + } tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], ARITH_MOV, args[0], 0, 1); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], @@ -1646,8 +1660,8 @@ static const TCGTargetOpDef arm_op_defs[] = { { INDEX_op_shr_i32, { "r", "r", "ri" } }, { INDEX_op_sar_i32, { "r", "r", "ri" } }, - { INDEX_op_brcond_i32, { "r", "r" } }, - { INDEX_op_setcond_i32, { "r", "r", "r" } }, + { INDEX_op_brcond_i32, { "r", "rI" } }, + { INDEX_op_setcond_i32, { "r", "r", "rI" } }, /* TODO: "r", "r", "r", "r", "ri", "ri" */ { INDEX_op_add2_i32, { "r", "r", "r", "r", "r", "r" } },