From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULEpP-0000lr-1U for qemu-devel@nongnu.org; Thu, 28 Mar 2013 11:33:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULEpI-0003Ug-Qd for qemu-devel@nongnu.org; Thu, 28 Mar 2013 11:33:22 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:43433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULEpI-0003UV-Ll for qemu-devel@nongnu.org; Thu, 28 Mar 2013 11:33:16 -0400 Received: by mail-pd0-f179.google.com with SMTP id x11so1214991pdj.24 for ; Thu, 28 Mar 2013 08:33:16 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 28 Mar 2013 08:32:44 -0700 Message-Id: <1364484781-15561-4-git-send-email-rth@twiddle.net> In-Reply-To: <1364484781-15561-1-git-send-email-rth@twiddle.net> References: <1364484781-15561-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v3 03/20] tcg-arm: Allow constant first argument to sub List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Aurelien Jarno This allows the generation of RSB instructions. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index f470caa..7475142 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -1665,8 +1665,17 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_sub_i32: - tcg_out_dat_rIN(s, COND_AL, ARITH_SUB, ARITH_ADD, - args[0], args[1], args[2], const_args[2]); + if (const_args[1]) { + if (const_args[2]) { + tcg_out_movi32(s, COND_AL, args[0], args[1] - args[2]); + } else { + tcg_out_dat_rI(s, COND_AL, ARITH_RSB, + args[0], args[2], args[1], 1); + } + } else { + tcg_out_dat_rIN(s, COND_AL, ARITH_SUB, ARITH_ADD, + args[0], args[1], args[2], const_args[2]); + } break; case INDEX_op_and_i32: tcg_out_dat_rIK(s, COND_AL, ARITH_AND, ARITH_BIC, @@ -1859,7 +1868,7 @@ static const TCGTargetOpDef arm_op_defs[] = { /* TODO: "r", "r", "ri" */ { INDEX_op_add_i32, { "r", "r", "rIN" } }, - { INDEX_op_sub_i32, { "r", "r", "rIN" } }, + { INDEX_op_sub_i32, { "r", "rI", "rIN" } }, { INDEX_op_mul_i32, { "r", "r", "r" } }, { INDEX_op_mulu2_i32, { "r", "r", "r", "r" } }, { INDEX_op_muls2_i32, { "r", "r", "r", "r" } }, -- 1.8.1.4