tcg-mips: Split large ldst offsets

Use this to reduce goto_tb by one insn.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Richard Henderson 2014-03-23 17:45:23 +00:00
parent 7dae901d2d
commit f9a716325f
1 changed files with 12 additions and 11 deletions

View File

@ -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, static void tcg_out_ldst(TCGContext *s, int opc, TCGReg data,
TCGReg arg1, TCGArg arg2) TCGReg addr, intptr_t ofs)
{ {
if (arg2 == (int16_t) arg2) { int16_t lo = ofs;
tcg_out_opc_imm(s, opc, arg, arg1, arg2); if (ofs != lo) {
} else { tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, ofs - lo);
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, arg2); if (addr != TCG_REG_ZERO) {
tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, arg1); tcg_out_opc_reg(s, OPC_ADDU, TCG_REG_AT, TCG_REG_AT, addr);
tcg_out_opc_imm(s, opc, arg, TCG_REG_AT, 0); }
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, 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(); tcg_abort();
} else { } else {
/* indirect jump method */ /* indirect jump method */
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_AT, tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_ZERO,
(uintptr_t)(s->tb_next + args[0])); (uintptr_t)(s->tb_next + args[0]));
tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_AT, TCG_REG_AT, 0);
tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0); tcg_out_opc_reg(s, OPC_JR, 0, TCG_REG_AT, 0);
} }
tcg_out_nop(s); tcg_out_nop(s);