From patchwork Sat Apr 10 01:32:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 49884 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 A429EB7C48 for ; Sat, 10 Apr 2010 11:52:34 +1000 (EST) Received: from localhost ([127.0.0.1]:33307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0Ps8-0003Pw-07 for incoming@patchwork.ozlabs.org; Fri, 09 Apr 2010 21:52:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0PZp-0004hQ-Kq for qemu-devel@nongnu.org; Fri, 09 Apr 2010 21:33:37 -0400 Received: from [140.186.70.92] (port=49427 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0PZk-0004di-ER for qemu-devel@nongnu.org; Fri, 09 Apr 2010 21:33:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0PZj-0007HF-0s for qemu-devel@nongnu.org; Fri, 09 Apr 2010 21:33:32 -0400 Received: from hall.aurel32.net ([88.191.82.174]:35048) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0PZi-0007HB-SF for qemu-devel@nongnu.org; Fri, 09 Apr 2010 21:33:30 -0400 Received: from [10.243.122.2] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1O0PZh-0005Ml-VQ; Sat, 10 Apr 2010 03:33:30 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.71) (envelope-from ) id 1O0PZU-0004kQ-0Y; Sat, 10 Apr 2010 03:33:16 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sat, 10 Apr 2010 03:32:56 +0200 Message-Id: <1270863186-10180-9-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1270863186-10180-1-git-send-email-aurelien@aurel32.net> References: <1270863186-10180-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Andrzej Zaborowski , Aurelien Jarno Subject: [Qemu-devel] [PATCH v2 08/18] tcg/arm: use the blx instruction when possible 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 | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index 8c55325..7758601 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -357,6 +357,11 @@ static inline void tcg_out_bl(TCGContext *s, int cond, int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } +static inline void tcg_out_blx(TCGContext *s, int cond, int rn) +{ + tcg_out32(s, (cond << 28) | 0x012fff30 | rn); +} + static inline void tcg_out_dat_reg(TCGContext *s, int cond, int opc, int rd, int rn, int rm, int shift) { @@ -778,10 +783,13 @@ static inline void tcg_out_call(TCGContext *s, int cond, uint32_t addr) static inline void tcg_out_callr(TCGContext *s, int cond, int arg) { - /* TODO: on ARMv5 and ARMv6 replace with tcg_out_blx(s, cond, arg); */ - tcg_out_dat_reg(s, cond, ARITH_MOV, TCG_REG_R14, 0, - TCG_REG_PC, SHIFT_IMM_LSL(0)); - tcg_out_bx(s, cond, arg); + if (use_armv5_instructions) { + tcg_out_blx(s, cond, arg); + } else { + tcg_out_dat_reg(s, cond, ARITH_MOV, TCG_REG_R14, 0, + TCG_REG_PC, SHIFT_IMM_LSL(0)); + tcg_out_bx(s, cond, arg); + } } static inline void tcg_out_goto_label(TCGContext *s, int cond, int label_index)