[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 18/26] target/s390x: Split per_branch
From: |
Richard Henderson |
Subject: |
[PATCH v1 18/26] target/s390x: Split per_branch |
Date: |
Tue, 6 Sep 2022 11:17:39 +0100 |
Split into per_branch_dest and per_branch_disp, which can be
used for direct and indirect. In preperation for TARGET_TB_PCREL,
call per_branch_* before indirect branches.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/s390x/tcg/translate.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 712f6d5795..bd2ee1c96e 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -350,21 +350,25 @@ static inline bool per_enabled(DisasContext *s)
#endif
}
-static void per_branch(DisasContext *s, bool to_next)
+static void per_branch_dest(DisasContext *s, TCGv_i64 dest)
{
#ifndef CONFIG_USER_ONLY
gen_psw_addr_disp(s, gbea, 0);
+ if (s->base.tb->flags & FLAG_MASK_PER) {
+ gen_helper_per_branch(cpu_env, gbea, dest);
+ }
+#endif
+}
- if (per_enabled(s)) {
- if (to_next) {
- TCGv_i64 next_pc = tcg_temp_new_i64();
-
- gen_psw_addr_disp(s, next_pc, s->ilen);
- gen_helper_per_branch(cpu_env, gbea, next_pc);
- tcg_temp_free_i64(next_pc);
- } else {
- gen_helper_per_branch(cpu_env, gbea, psw_addr);
- }
+static void per_branch_disp(DisasContext *s, int64_t disp)
+{
+#ifndef CONFIG_USER_ONLY
+ gen_psw_addr_disp(s, gbea, 0);
+ if (s->base.tb->flags & FLAG_MASK_PER) {
+ TCGv_i64 dest = tcg_temp_new_i64();
+ gen_psw_addr_disp(s, dest, disp);
+ gen_helper_per_branch(cpu_env, gbea, dest);
+ tcg_temp_free_i64(dest);
}
#endif
}
@@ -1172,7 +1176,7 @@ struct DisasInsn {
static DisasJumpType help_goto_direct(DisasContext *s, int64_t disp)
{
if (disp == s->ilen) {
- per_branch(s, true);
+ per_branch_disp(s, disp);
return DISAS_NEXT;
}
if (use_goto_tb(s, s->base.pc_next + disp)) {
@@ -1184,7 +1188,7 @@ static DisasJumpType help_goto_direct(DisasContext *s,
int64_t disp)
return DISAS_NORETURN;
} else {
update_psw_addr_disp(s, disp);
- per_branch(s, false);
+ per_branch_dest(s, psw_addr);
return DISAS_PC_UPDATED;
}
}
@@ -1192,7 +1196,7 @@ static DisasJumpType help_goto_direct(DisasContext *s,
int64_t disp)
static DisasJumpType help_goto_indirect(DisasContext *s, TCGv_i64 dest)
{
tcg_gen_mov_i64(psw_addr, dest);
- per_branch(s, false);
+ per_branch_dest(s, psw_addr);
return DISAS_PC_UPDATED;
}
--
2.34.1
- [PATCH v1 07/26] target/s390x: Remove pc argument to pc_to_link_into, (continued)
- [PATCH v1 07/26] target/s390x: Remove pc argument to pc_to_link_into, Richard Henderson, 2022/09/06
- [PATCH v1 06/26] target/s390x: Introduce gen_psw_addr_disp, Richard Henderson, 2022/09/06
- [PATCH v1 17/26] target/s390x: Introduce help_goto_indirect, Richard Henderson, 2022/09/06
- [PATCH v1 13/26] target/s390x: Add disp argument to update_psw_addr, Richard Henderson, 2022/09/06
- [PATCH v1 22/26] target/s390x: Pass original r2 register to BCR, Richard Henderson, 2022/09/06
- [PATCH v1 10/26] target/s390x: Use gen_psw_addr_disp in op_sam, Richard Henderson, 2022/09/06
- [PATCH v1 11/26] target/s390x: Use ilen instead in branches, Richard Henderson, 2022/09/06
- [PATCH v1 09/26] target/s390x: Use gen_psw_addr_disp in save_link_info, Richard Henderson, 2022/09/06
- [PATCH v1 18/26] target/s390x: Split per_branch,
Richard Henderson <=
- [PATCH v1 08/26] target/s390x: Use gen_psw_addr_disp in pc_to_link_info, Richard Henderson, 2022/09/06
- [PATCH v1 12/26] target/s390x: Move masking of psw.addr to cpu_get_tb_cpu_state, Richard Henderson, 2022/09/06
- [PATCH v1 14/26] target/s390x: Don't set gbea for user-only, Richard Henderson, 2022/09/06
- [PATCH v1 19/26] target/s390x: Simplify help_branch, Richard Henderson, 2022/09/06
- [PATCH v1 16/26] target/s390x: Disable conditional branch-to-next for PER, Richard Henderson, 2022/09/06
- [PATCH v1 15/26] target/s390x: Introduce per_enabled, Richard Henderson, 2022/09/06
- [PATCH v1 25/26] tcg: Introduce tcg_temp_is_normal_*, Richard Henderson, 2022/09/06
- [PATCH v1 21/26] target/s390x: Remove PER check from use_goto_tb, Richard Henderson, 2022/09/06
- [PATCH v1 24/26] tcg: Introduce tcg_temp_ebb_new_*, Richard Henderson, 2022/09/06