[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/13] target/xtensa: only rotate window in the retw
From: |
Max Filippov |
Subject: |
[Qemu-devel] [PATCH 08/13] target/xtensa: only rotate window in the retw helper |
Date: |
Thu, 14 Feb 2019 14:59:55 -0800 |
Move return address calculation and WINDOW_START adjustment out of the
retw helper to simplify logic a bit and avoid using registers directly.
Pass a0 as a parameter to the helper.
Signed-off-by: Max Filippov <address@hidden>
---
target/xtensa/helper.h | 2 +-
target/xtensa/translate.c | 9 +++++++--
target/xtensa/win_helper.c | 8 ++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/target/xtensa/helper.h b/target/xtensa/helper.h
index b6529a8925f3..0b9ec670c86e 100644
--- a/target/xtensa/helper.h
+++ b/target/xtensa/helper.h
@@ -7,7 +7,7 @@ DEF_HELPER_1(sync_windowbase, void, env)
DEF_HELPER_4(entry, void, env, i32, i32, i32)
DEF_HELPER_2(test_ill_retw, void, env, i32)
DEF_HELPER_2(test_underflow_retw, void, env, i32)
-DEF_HELPER_2(retw, i32, env, i32)
+DEF_HELPER_2(retw, void, env, i32)
DEF_HELPER_3(window_check, noreturn, env, i32, i32)
DEF_HELPER_1(restore_owb, void, env)
DEF_HELPER_2(movsp, void, env, i32)
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 0213cef1b605..f991cc360889 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -2226,8 +2226,13 @@ static bool test_ill_retw(DisasContext *dc, const
uint32_t arg[],
static void translate_retw(DisasContext *dc, const uint32_t arg[],
const uint32_t par[])
{
- TCGv_i32 tmp = tcg_const_i32(dc->pc);
- gen_helper_retw(tmp, cpu_env, tmp);
+ TCGv_i32 tmp = tcg_const_i32(1);
+ tcg_gen_shl_i32(tmp, tmp, cpu_SR[WINDOW_BASE]);
+ tcg_gen_andc_i32(cpu_SR[WINDOW_START],
+ cpu_SR[WINDOW_START], tmp);
+ tcg_gen_movi_i32(tmp, dc->pc);
+ tcg_gen_deposit_i32(tmp, tmp, cpu_R[0], 0, 30);
+ gen_helper_retw(cpu_env, cpu_R[0]);
gen_jump(dc, tmp);
tcg_temp_free(tmp);
}
diff --git a/target/xtensa/win_helper.c b/target/xtensa/win_helper.c
index d7a4e2782186..f6f96a64c30e 100644
--- a/target/xtensa/win_helper.c
+++ b/target/xtensa/win_helper.c
@@ -184,15 +184,11 @@ void HELPER(test_underflow_retw)(CPUXtensaState *env,
uint32_t pc)
}
}
-uint32_t HELPER(retw)(CPUXtensaState *env, uint32_t pc)
+void HELPER(retw)(CPUXtensaState *env, uint32_t a0)
{
- int n = (env->regs[0] >> 30) & 0x3;
- uint32_t windowbase = windowbase_bound(env->sregs[WINDOW_BASE], env);
- uint32_t ret_pc = (pc & 0xc0000000) | (env->regs[0] & 0x3fffffff);
+ int n = (a0 >> 30) & 0x3;
xtensa_rotate_window(env, -n);
- env->sregs[WINDOW_START] &= ~windowstart_bit(windowbase, env);
- return ret_pc;
}
void xtensa_restore_owb(CPUXtensaState *env)
--
2.11.0
- [Qemu-devel] [PATCH 11/13] target/xtensa: reorganize access to boolean registers, (continued)
- [Qemu-devel] [PATCH 11/13] target/xtensa: reorganize access to boolean registers, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 09/13] target/xtensa: reorganize register handling in translators, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 10/13] target/xtensa: reorganize access to MAC16 registers, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 04/13] target/xtensa: implement wide branches and loops, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 01/13] target/xtensa: move xtensa_finalize_config to xtensa_core_class_init, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 07/13] target/xtensa: move WINDOW_BASE SR update to postprocessing, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 05/13] target/xtensa: sort FLIX instruction opcodes, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 02/13] target/xtensa: don't require opcode table sorting, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 03/13] target/xtensa: allow multiple names for single opcode, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 06/13] target/xtensa: add generic instruction post-processing, Max Filippov, 2019/02/14
- [Qemu-devel] [PATCH 08/13] target/xtensa: only rotate window in the retw helper,
Max Filippov <=