From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEH5-0002dD-S6 for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WoEGz-0001DI-OB for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:19 -0400 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:43046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoEGz-0001D7-F7 for qemu-devel@nongnu.org; Sat, 24 May 2014 11:54:13 -0400 Received: by mail-pa0-f46.google.com with SMTP id kq14so5479140pab.19 for ; Sat, 24 May 2014 08:54:12 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Sat, 24 May 2014 08:53:41 -0700 Message-Id: <1400946841-21079-5-git-send-email-rth@twiddle.net> In-Reply-To: <1400946841-21079-1-git-send-email-rth@twiddle.net> References: <1400946841-21079-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 04/24] tcg-mips: Fill the exit_tb delay slot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Reviewed-by: Paolo Bonzini Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c index d4236c0..2d2073f 100644 --- a/tcg/mips/tcg-target.c +++ b/tcg/mips/tcg-target.c @@ -392,8 +392,10 @@ static inline void tcg_out_movi(TCGContext *s, TCGType type, } else if (arg == (uint16_t)arg) { tcg_out_opc_imm(s, OPC_ORI, reg, TCG_REG_ZERO, arg); } else { - tcg_out_opc_imm(s, OPC_LUI, reg, 0, arg >> 16); - tcg_out_opc_imm(s, OPC_ORI, reg, reg, arg & 0xffff); + tcg_out_opc_imm(s, OPC_LUI, reg, TCG_REG_ZERO, arg >> 16); + if (arg & 0xffff) { + tcg_out_opc_imm(s, OPC_ORI, reg, reg, arg & 0xffff); + } } } @@ -1291,12 +1293,21 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, { switch(opc) { case INDEX_op_exit_tb: - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_V0, args[0]); - if (!tcg_out_opc_jmp(s, OPC_J, tb_ret_addr)) { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, (uintptr_t)tb_ret_addr); - tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0); + { + uintptr_t a0 = args[0]; + TCGReg b0 = TCG_REG_ZERO; + + if (a0 & ~0xffff) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_V0, a0 & ~0xffff); + b0 = TCG_REG_V0; + } + if (!tcg_out_opc_jmp(s, OPC_J, tb_ret_addr)) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, + (uintptr_t)tb_ret_addr); + tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0); + } + tcg_out_opc_imm(s, OPC_ORI, TCG_REG_V0, b0, a0 & 0xffff); } - tcg_out_nop(s); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { -- 1.9.0