Commit 3abef2f809 for qemu.org
commit 3abef2f809ba527ded81cb97d99833cc40252ec1
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Tue Nov 10 18:58:38 2026 +0100
target/mips: Pass the right instruction size for nanoMIPS RESTORE.JRC
RESTORE.JRC[32] is a 32-bit instruction (MD01247, printed page 155),
but gen_compute_branch_nm() was called with an instruction size of 2
(copy/paste from the 16-bit form), which wrongly set MIPS_HFLAG_B16.
No functional effect: gen_branch() clears MIPS_HFLAG_B16 before
anything reads it.
Fixes: c02809830346 ("target/mips: Add emulation of some nanoMIPS 32-bit instr")
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261113161158.25811-12-philmd@oss.qualcomm.com>
diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/tcg/nanomips_translate.c.inc
index f1462c971a..39ba962305 100644
--- a/target/mips/tcg/nanomips_translate.c.inc
+++ b/target/mips/tcg/nanomips_translate.c.inc
@@ -3745,7 +3745,7 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
extract32(ctx->opcode, 2, 1),
extract32(ctx->opcode, 3, 9) << 3);
if ((ctx->opcode & 3) == NM_RESTORE_JRC) {
- gen_compute_branch_nm(ctx, OPC_JR, 2, 31, 0, 0);
+ gen_compute_branch_nm(ctx, OPC_JR, 4, 31, 0, 0);
}
break;
default: