[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/10] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst
From: |
Richard Henderson |
Subject: |
[PATCH v2 09/10] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst |
Date: |
Tue, 17 Jan 2023 15:11:22 -1000 |
Take the w^x split into account when computing the
pc-relative distance to an absolute pointer.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/loongarch64/tcg-target.c.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index 29d75c80eb..d6926bdb83 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -702,7 +702,7 @@ static void tcg_out_ldst(TCGContext *s, LoongArchInsn opc,
TCGReg data,
intptr_t imm12 = sextreg(offset, 0, 12);
if (offset != imm12) {
- intptr_t diff = offset - (uintptr_t)s->code_ptr;
+ intptr_t diff = tcg_pcrel_diff(s, (void *)offset);
if (addr == TCG_REG_ZERO && diff == (int32_t)diff) {
imm12 = sextreg(diff, 0, 12);
--
2.34.1
- Re: [PATCH v2 04/10] tcg/loongarch64: Optimize immediate loading, (continued)
- [PATCH v2 05/10] tcg/loongarch64: Update tcg-insn-defs.c.inc, Richard Henderson, 2023/01/17
- [PATCH v2 06/10] tcg/loongarch64: Introduce tcg_out_addi, Richard Henderson, 2023/01/17
- [PATCH v2 07/10] tcg/loongarch64: Improve setcond expansion, Richard Henderson, 2023/01/17
- [PATCH v2 08/10] tcg/loongarch64: Implement movcond, Richard Henderson, 2023/01/17
- [PATCH v2 09/10] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst,
Richard Henderson <=
- [PATCH v2 10/10] tcg/loongarch64: Reorg goto_tb implementation, Richard Henderson, 2023/01/17
- Re: [PATCH v2 00/10] tcg/loongarch64: Reorg goto_tb and cleanups, WANG Xuerui, 2023/01/22