[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/16] tcg/mips: Try tb-relative addresses in tcg_out_movi
From: |
Richard Henderson |
Subject: |
[PATCH v3 15/16] tcg/mips: Try tb-relative addresses in tcg_out_movi |
Date: |
Wed, 18 Aug 2021 10:19:30 -1000 |
These addresses are often loaded by the qemu_ld/st slow path,
for loading the retaddr value.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/mips/tcg-target.c.inc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
index f641d86561..27a23662c8 100644
--- a/tcg/mips/tcg-target.c.inc
+++ b/tcg/mips/tcg-target.c.inc
@@ -582,6 +582,8 @@ static void tcg_out_movi_pool(TCGContext *s, TCGReg ret,
static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,
tcg_target_long arg, TCGReg tbreg)
{
+ tcg_target_long tmp;
+
if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) {
arg = (int32_t)arg;
}
@@ -592,6 +594,17 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type,
TCGReg ret,
}
assert(TCG_TARGET_REG_BITS == 64);
+ /* Load addresses within 2GB of TB with 1 or 3 insns. */
+ tmp = tcg_tbrel_diff(s, (void *)arg);
+ if (tmp == (int16_t)tmp) {
+ tcg_out_opc_imm(s, OPC_DADDIU, ret, tbreg, tmp);
+ return;
+ }
+ if (tcg_out_movi_two(s, ret, tmp)) {
+ tcg_out_opc_reg(s, OPC_DADDU, ret, ret, tbreg);
+ return;
+ }
+
/* Otherwise, put 64-bit constants into the constant pool. */
tcg_out_movi_pool(s, ret, arg, tbreg);
}
--
2.25.1
- Re: [PATCH v3 04/16] tcg/mips: Move TCG_AREG0 to S8, (continued)
- [PATCH v3 07/16] tcg/mips: Allow JAL to be out of range in tcg_out_bswap_subr, Richard Henderson, 2021/08/18
- [PATCH v3 05/16] tcg/mips: Move TCG_GUEST_BASE_REG to S7, Richard Henderson, 2021/08/18
- [PATCH v3 11/16] tcg/mips: Split out tcg_out_movi_one, Richard Henderson, 2021/08/18
- [PATCH v3 03/16] tcg/mips: Drop inline markers, Richard Henderson, 2021/08/18
- [PATCH v3 09/16] tcg/mips: Drop special alignment for code_gen_buffer, Richard Henderson, 2021/08/18
- [PATCH v3 10/16] tcg/mips: Create and use TCG_REG_TB, Richard Henderson, 2021/08/18
- [PATCH v3 15/16] tcg/mips: Try tb-relative addresses in tcg_out_movi,
Richard Henderson <=
- [PATCH v3 12/16] tcg/mips: Split out tcg_out_movi_two, Richard Henderson, 2021/08/18
- [PATCH v3 14/16] tcg/mips: Aggressively use the constant pool for n64 calls, Richard Henderson, 2021/08/18
- [PATCH v3 13/16] tcg/mips: Use the constant pool for 64-bit constants, Richard Henderson, 2021/08/18
- [PATCH v3 16/16] tcg/mips: Try three insns with shift and add in tcg_out_movi, Richard Henderson, 2021/08/18
- Re: [PATCH v3 00/16] tcg/mips: Unaligned access and other cleanup, Philippe Mathieu-Daudé, 2021/08/18