aboutsummaryrefslogtreecommitdiff
path: root/target/rx/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/rx/translate.c')
-rw-r--r--target/rx/translate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/target/rx/translate.c b/target/rx/translate.c
index bd4d110e8b..63c062993e 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -2165,7 +2165,12 @@ static inline void clrsetpsw(DisasContext *ctx, int cb, int val)
ctx->base.is_jmp = DISAS_UPDATE;
break;
case PSW_U:
- tcg_gen_movi_i32(cpu_psw_u, val);
+ if (FIELD_EX32(ctx->tb_flags, PSW, U) != val) {
+ ctx->tb_flags = FIELD_DP32(ctx->tb_flags, PSW, U, val);
+ tcg_gen_movi_i32(cpu_psw_u, val);
+ tcg_gen_mov_i32(val ? cpu_isp : cpu_usp, cpu_sp);
+ tcg_gen_mov_i32(cpu_sp, val ? cpu_usp : cpu_isp);
+ }
break;
default:
qemu_log_mask(LOG_GUEST_ERROR, "Invalid distination %d", cb);