Received: from eggs.gnu.org ([2001:4830:134:3::10]:59531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkTRy-0008Vc-SX for qemu-devel@nongnu.org; Wed, 14 May 2014 03:18:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkTRp-0006V8-On for qemu-devel@nongnu.org; Wed, 14 May 2014 03:18:02 -0400 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:54303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkTRp-0006Uf-J0 for qemu-devel@nongnu.org; Wed, 14 May 2014 03:17:53 -0400 Received: by mail-pa0-f41.google.com with SMTP id lj1so1323672pab.14 for ; Wed, 14 May 2014 00:17:52 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Wed, 14 May 2014 00:17:22 -0700 Message-Id: <1400051861-5848-6-git-send-email-rth@twiddle.net> In-Reply-To: <1400051861-5848-1-git-send-email-rth@twiddle.net> References: <1400051861-5848-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 05/24] tcg-mips: Split large ldst offsets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aurelien@aurel32.net Use this to reduce goto_tb by one insn. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c index 2d2073f..5ccfb1d 100644 --- a/tcg/mips/tcg-target.c +++ b/tcg/mips/tcg-target.c @@ -480,16 +480,18 @@ static inline void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg) } } -static inline void tcg_out_ldst(TCGContext *s, int opc, TCGArg arg, - TCGReg arg1, TCGArg arg2) +static void tcg_out_ldst(TCGContext *s, int opc, TCGReg data, + TCGReg addr, intptr_t ofs) { - if (arg2 == (int16_t) arg2) { - tcg_out_opc_imm(s, opc, arg, arg1, arg2); - } else { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, arg2); - tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, arg1); - tcg_out_opc_imm(s, opc, arg, TCG_REG_AT, 0); + int16_t lo = ofs; + if (ofs != lo) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, ofs - lo); + if (addr != TCG_REG_ZERO) { + tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, addr); + } + addr = TCG_REG_AT; } + tcg_out_opc_imm(s, opc, data, addr, lo); } static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, @@ -1315,9 +1317,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_abort(); } else { /* indirect jump method */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, - (uintptr_t)(s->tb_next + args[0])); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_AT, 0); + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_ZERO, + (uintptr_t)(s->tb_next + args[0])); tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0); } tcg_out_nop(s); -- 1.9.0