[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/10] target/s390x: Change help_goto_direct to work on displa
From: |
Richard Henderson |
Subject: |
[PATCH v2 01/10] target/s390x: Change help_goto_direct to work on displacements |
Date: |
Wed, 5 Jun 2024 14:57:30 -0700 |
In preparation for CF_PCREL, reduce reliance on absolute values.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/s390x/tcg/translate.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index c81e035dea..f25ae02a4e 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -1073,13 +1073,15 @@ struct DisasInsn {
/* ====================================================================== */
/* Miscellaneous helpers, used by several operations. */
-static DisasJumpType help_goto_direct(DisasContext *s, uint64_t dest)
+static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp)
{
+ uint64_t dest = s->base.pc_next + disp;
+
update_cc_op(s);
per_breaking_event(s);
per_branch(s, tcg_constant_i64(dest));
- if (dest == s->pc_tmp) {
+ if (disp == s->ilen) {
return DISAS_NEXT;
}
if (use_goto_tb(s, dest)) {
@@ -1105,7 +1107,8 @@ static DisasJumpType help_goto_indirect(DisasContext *s,
TCGv_i64 dest)
static DisasJumpType help_branch(DisasContext *s, DisasCompare *c,
bool is_imm, int imm, TCGv_i64 cdest)
{
- uint64_t dest = s->base.pc_next + (int64_t)imm * 2;
+ int64_t disp = (int64_t)imm * 2;
+ uint64_t dest = s->base.pc_next + disp;
TCGLabel *lab;
/* Take care of the special cases first. */
@@ -1120,7 +1123,7 @@ static DisasJumpType help_branch(DisasContext *s,
DisasCompare *c,
if (c->cond == TCG_COND_ALWAYS
|| (dest == s->pc_tmp &&
!(s->base.tb->flags & FLAG_MASK_PER_BRANCH))) {
- return help_goto_direct(s, dest);
+ return help_goto_direct(s, disp);
}
} else {
if (!cdest) {
--
2.34.1
- [PATCH v2 00/10] target/s390x: pc-relative translation, Richard Henderson, 2024/06/05
- [PATCH v2 01/10] target/s390x: Change help_goto_direct to work on displacements,
Richard Henderson <=
- [PATCH v2 02/10] target/s390x: Introduce gen_psw_addr_disp, Richard Henderson, 2024/06/05
- [PATCH v2 03/10] target/s390x: Remove pc argument to pc_to_link_into, Richard Henderson, 2024/06/05
- [PATCH v2 04/10] target/s390x: Use gen_psw_addr_disp in pc_to_link_info, Richard Henderson, 2024/06/05
- [PATCH v2 05/10] target/s390x: Use gen_psw_addr_disp in save_link_info, Richard Henderson, 2024/06/05
- [PATCH v2 06/10] target/s390x: Use deposit in save_link_info, Richard Henderson, 2024/06/05
- [PATCH v2 08/10] target/s390x: Use ilen instead in branches, Richard Henderson, 2024/06/05
- [PATCH v2 07/10] target/s390x: Use gen_psw_addr_disp in op_sam, Richard Henderson, 2024/06/05
- [PATCH v2 09/10] target/s390x: Assert masking of psw.addr in cpu_get_tb_cpu_state, Richard Henderson, 2024/06/05
- [PATCH v2 10/10] target/s390x: Enable CF_PCREL, Richard Henderson, 2024/06/05