* [PATCH] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr
@ 2024-10-05 22:15 Richard Henderson
2024-10-06 8:32 ` Michael Tokarev
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2024-10-05 22:15 UTC (permalink / raw)
To: qemu-devel; +Cc: mjt
In tcg_out_qemu_ldst_i128, we need a non-zero index register,
which we then use as a base register in several address modes.
Since we always have TCG_REG_TMP2 available, use that.
In tcg_out_qemu_st, in the fallback when STDBRX is not available,
avoid clobbering TCG_REG_TMP1, which might be h.base, which is
still in use. Use TCG_REG_TMP2 instead. Since the final use of
h.index is that ADDI, there is no conflict with the above.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2597
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/ppc/tcg-target.c.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index 3f413ce3c1..223f079524 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -2617,8 +2617,8 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
if (TCG_TARGET_REG_BITS == 64 && addr_type == TCG_TYPE_I32) {
/* Zero-extend the guest address for use in the host address. */
- tcg_out_ext32u(s, TCG_REG_R0, addrlo);
- h->index = TCG_REG_R0;
+ tcg_out_ext32u(s, TCG_REG_TMP2, addrlo);
+ h->index = TCG_REG_TMP2;
} else {
h->index = addrlo;
}
@@ -2704,9 +2704,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg datalo, TCGReg datahi,
uint32_t insn = qemu_stx_opc[opc & (MO_BSWAP | MO_SIZE)];
if (!have_isa_2_06 && insn == STDBRX) {
tcg_out32(s, STWBRX | SAB(datalo, h.base, h.index));
- tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, h.index, 4));
+ tcg_out32(s, ADDI | TAI(TCG_REG_TMP2, h.index, 4));
tcg_out_shri64(s, TCG_REG_R0, datalo, 32);
- tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP1));
+ tcg_out32(s, STWBRX | SAB(TCG_REG_R0, h.base, TCG_REG_TMP2));
} else {
tcg_out32(s, insn | SAB(datalo, h.base, h.index));
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr
2024-10-05 22:15 [PATCH] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Richard Henderson
@ 2024-10-06 8:32 ` Michael Tokarev
0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2024-10-06 8:32 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
06.10.2024 01:15, Richard Henderson wrote:
> In tcg_out_qemu_ldst_i128, we need a non-zero index register,
> which we then use as a base register in several address modes.
> Since we always have TCG_REG_TMP2 available, use that.
>
> In tcg_out_qemu_st, in the fallback when STDBRX is not available,
> avoid clobbering TCG_REG_TMP1, which might be h.base, which is
> still in use. Use TCG_REG_TMP2 instead. Since the final use of
> h.index is that ADDI, there is no conflict with the above.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2597
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Fixes: v8.0.0-524-ge3867bad0d "tcg/ppc: Introduce HostAddress"
Fixes: v8.0.0-744-g01a112e2e9 "tcg/ppc: Reorg tcg_out_tlb_read"
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
Also noted for -stable.
Thank you!
/mjt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-06 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 22:15 [PATCH] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr Richard Henderson
2024-10-06 8:32 ` Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).