Commit 08a22c7946 for qemu.org

commit 08a22c7946f452648133743ab244926240e69311
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date:   Tue Nov 10 20:04:38 2026 +0100

    target/mips: Require rt == 0 when decoding BLEZL/BGTZL

    The BLEZL and BGTZL encodings fix rt to 00000. The legacy
    decoder ignored rt on non-R6 CPUs, executing reserved encodings
    as BLEZL/BGTZL instead of raising Reserved Instruction. On R6
    these opcodes are the compact branches, which already reject
    rt == 0.

    Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-ID: <20261113161158.25811-3-philmd@oss.qualcomm.com>

diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index f521e0ec5b..6e7e1a0f75 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -14621,6 +14621,10 @@ static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx)
             gen_compute_compact_branch(ctx, op, rs, rt, imm << 2);
         } else {
             /* OPC_BLEZL */
+            if (rt != 0) {
+                gen_reserved_instruction(ctx);
+                break;
+            }
             check_insn(ctx, ISA_MIPS2);
             gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4);
         }
@@ -14635,6 +14639,10 @@ static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx)
             gen_compute_compact_branch(ctx, op, rs, rt, imm << 2);
         } else {
             /* OPC_BGTZL */
+            if (rt != 0) {
+                gen_reserved_instruction(ctx);
+                break;
+            }
             check_insn(ctx, ISA_MIPS2);
             gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4);
         }