summaryrefslogtreecommitdiff
path: root/target/sh4
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2017-07-18 10:02:45 -1000
committerAurelien Jarno <aurelien@aurel32.net>2017-07-18 23:39:17 +0200
commitdec4f042a16b830c4d4613561f5f29e6a3263c1f (patch)
treea8e5f6f0ec8dfd6d40146e684269e3e205db3dce /target/sh4
parent6b98213da9b025dad0f1bd307928a4f30e96a50d (diff)
target/sh4: Unify code for CHECK_FPU_ENABLED
We do not need to emit N copies of raising an exception. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net> Message-Id: <20170718200255.31647-21-rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target/sh4')
-rw-r--r--target/sh4/translate.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 2476b948b9..b90719717e 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -374,16 +374,9 @@ static inline void gen_store_fpr64(DisasContext *ctx, TCGv_i64 t, int reg)
goto do_illegal; \
}
-#define CHECK_FPU_ENABLED \
- if (ctx->tbflags & (1u << SR_FD)) { \
- gen_save_cpu_state(ctx, true); \
- if (ctx->envflags & DELAY_SLOT_MASK) { \
- gen_helper_raise_slot_fpu_disable(cpu_env); \
- } else { \
- gen_helper_raise_fpu_disable(cpu_env); \
- } \
- ctx->bstate = BS_EXCP; \
- return; \
+#define CHECK_FPU_ENABLED \
+ if (ctx->tbflags & (1u << SR_FD)) { \
+ goto do_fpu_disabled; \
}
static void _decode_opc(DisasContext * ctx)
@@ -1796,6 +1789,17 @@ static void _decode_opc(DisasContext * ctx)
gen_helper_raise_illegal_instruction(cpu_env);
}
ctx->bstate = BS_EXCP;
+ return;
+
+ do_fpu_disabled:
+ gen_save_cpu_state(ctx, true);
+ if (ctx->envflags & DELAY_SLOT_MASK) {
+ gen_helper_raise_slot_fpu_disable(cpu_env);
+ } else {
+ gen_helper_raise_fpu_disable(cpu_env);
+ }
+ ctx->bstate = BS_EXCP;
+ return;
}
static void decode_opc(DisasContext * ctx)