On 07/06/2017 11:21 PM, Richard Henderson wrote:
We do not need to emit N copies of raising an exception.

Signed-off-by: Richard Henderson <r...@twiddle.net>

Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org>

---
  target/sh4/translate.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 3453f19..41157a0 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -377,11 +377,8 @@ static inline void gen_store_fpr64(DisasContext *ctx, 
TCGv_i64 t, int reg)
  #define XHACK(x) ((((x) & 1 ) << 4) | ((x) & 0xe))
#define CHECK_NOT_DELAY_SLOT \
-    if (ctx->envflags & DELAY_SLOT_MASK) {                           \
-        gen_save_cpu_state(ctx, true);                               \
-        gen_helper_raise_slot_illegal_instruction(cpu_env);          \
-        ctx->bstate = BS_EXCP;                                       \
-        return;                                                      \
+    if (ctx->envflags & DELAY_SLOT_MASK) {  \
+        goto do_illegal_slot;               \
      }
#define CHECK_PRIVILEGED \
@@ -1820,10 +1817,12 @@ static void _decode_opc(DisasContext * ctx)
            ctx->opcode, ctx->pc);
      fflush(stderr);
  #endif
-    gen_save_cpu_state(ctx, true);
      if (ctx->envflags & DELAY_SLOT_MASK) {
+ do_illegal_slot:
+        gen_save_cpu_state(ctx, true);
          gen_helper_raise_slot_illegal_instruction(cpu_env);
      } else {
+        gen_save_cpu_state(ctx, true);
          gen_helper_raise_illegal_instruction(cpu_env);
      }
      ctx->bstate = BS_EXCP;


Reply via email to