All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PATCH 7/8] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst
Date: Mon,  5 Dec 2022 22:40:50 -0600	[thread overview]
Message-ID: <20221206044051.322543-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20221206044051.322543-1-richard.henderson@linaro.org>

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 2044897e36..47465b8c20 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -701,7 +701,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



  parent reply	other threads:[~2022-12-06  4:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  4:40 [PATCH 0/8] tcg/loongarch64: Reorg goto_tb and cleanups Richard Henderson
2022-12-06  4:40 ` [PATCH 1/8] target/loongarch: Enable the disassembler for host tcg Richard Henderson
2022-12-15  7:44   ` Philippe Mathieu-Daudé
2022-12-06  4:40 ` [PATCH 2/8] tcg/loongarch64: Optimize immediate loading Richard Henderson
2022-12-06  4:40 ` [PATCH 3/8] tcg/loongarch64: Update tcg-insn-defs.c.inc Richard Henderson
2022-12-15  7:50   ` Philippe Mathieu-Daudé
2022-12-15 15:51     ` Richard Henderson
2022-12-15 19:50       ` WANG Xuerui
2022-12-15 19:59         ` Richard Henderson
2022-12-06  4:40 ` [PATCH 4/8] tcg/loongarch64: Introduce tcg_out_addi Richard Henderson
2022-12-06  4:40 ` [PATCH 5/8] tcg/loongarch64: Improve setcond expansion Richard Henderson
2022-12-06  4:40 ` [PATCH 6/8] tcg/loongarch64: Implement movcond Richard Henderson
2022-12-06  4:40 ` Richard Henderson [this message]
2022-12-06  7:16   ` [PATCH 7/8] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst Philippe Mathieu-Daudé
2022-12-06  7:30   ` Philippe Mathieu-Daudé
2022-12-06  4:40 ` [PATCH 8/8] tcg/loongarch64: Reorg goto_tb implementation Richard Henderson
2022-12-15  7:53 ` [PATCH 0/8] tcg/loongarch64: Reorg goto_tb and cleanups Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221206044051.322543-8-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.