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é <[email protected]>
---
 target/mips/tcg/nanomips_translate.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/mips/tcg/nanomips_translate.c.inc 
b/target/mips/tcg/nanomips_translate.c.inc
index 3e326afd0827..5941889b617b 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:
-- 
2.55.0


Reply via email to