All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 13/19] target/mips: Fix nanoMIPS BEQC16/BNEC16 corner cases
Date: Tue, 17 Nov 2026 23:37:24 +0100	[thread overview]
Message-ID: <c4eafbdd-e5ac-453b-afab-2f0a0fdddfe4@oss.qualcomm.com> (raw)
In-Reply-To: <eea3dea3-5a85-4b9e-a74d-17f3d5c56296@linaro.org>

On 17/11/26 20:18, Richard Henderson wrote:
> On 11/13/26 08:11, Philippe Mathieu-Daudé wrote:
>> BNEC[16] with identical registers is never taken, so it is a NOP.
>> gen_compute_branch_nm() instead wrote $ra and skipped the next
>> 4 bytes as if it were a MIPS branch-and-link-likely.
>>
>> Also raise Reserved Instruction on NMS cores, where the 16-bit
>> forms are not available.
>>
>> Fixes: 764371d24c51 ("target/mips: Add emulation of nanoMIPS 16-bit 
>> branch")
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>>   target/mips/tcg/nanomips_translate.c.inc | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/ 
>> tcg/nanomips_translate.c.inc
>> index f9dc573dbb01..25d57e75a0b0 100644
>> --- a/target/mips/tcg/nanomips_translate.c.inc
>> +++ b/target/mips/tcg/nanomips_translate.c.inc
>> @@ -4756,6 +4756,10 @@ static int decode_isa_nanomips(CPUMIPSState 
>> *env, DisasContext *ctx)
>>                   /* P16.BRI */
>>                   uint32_t opc = extract32(ctx->opcode, 4, 3) <
>>                                  extract32(ctx->opcode, 7, 3) ? 
>> OPC_BEQ : OPC_BNE;
>> +                check_nms(ctx);
>> +                if (rs == rt) {
>> +                    break;
>> +                }
>>                   gen_compute_branch_nm(ctx, opc, 2, rs, rt,
>>                                         extract32(ctx->opcode, 0, 4) 
>> << 1);
>>               }
> 
> Surely not.  BNE x,x is never taken, but BEQ x,x is.

Right... Updated as:

-                if (rs == rt) {
+                if (opc == OPC_BNE && rs == rt) {



  reply	other threads:[~2026-11-17 22:38 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:11 [PATCH 00/19] target/mips: Mixed bag of fixes Philippe Mathieu-Daudé
2026-11-13 16:11 ` [PATCH 01/19] target/mips: Check for MIPS II when decoding BLEZL/BGTZL Philippe Mathieu-Daudé
2026-11-17 18:54   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 02/19] target/mips: Require rt == 0 " Philippe Mathieu-Daudé
2026-11-17 18:57   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 03/19] target/mips: Require the MT module for MFTR/MTTR Philippe Mathieu-Daudé
2026-11-17 19:00   ` Richard Henderson
2026-11-17 22:35     ` Philippe Mathieu-Daudé
2026-11-18  0:01       ` Richard Henderson
2026-11-13 16:11 ` [PATCH 04/19] target/mips: Reject the PMON encoding on Release 6 Philippe Mathieu-Daudé
2026-11-17 19:04   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 05/19] target/mips: Enforce alignment and 64-bit CPU for the DSP LX loads Philippe Mathieu-Daudé
2026-11-17 19:05   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 06/19] target/mips: Fix reset into microMIPS mode when Config3.ISA is 3 Philippe Mathieu-Daudé
2026-11-17 19:06   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 07/19] target/mips: Fix microMIPS BC2NEZC POOL32I minor opcode Philippe Mathieu-Daudé
2026-11-17 19:07   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 08/19] target/mips: Fix microMIPS CACHE offset used for ITC tag access Philippe Mathieu-Daudé
2026-11-17 19:08   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 09/19] target/mips: Add the NMS check to the nanoMIPS CACHE instruction Philippe Mathieu-Daudé
2026-11-17 19:12   ` Richard Henderson
2026-11-17 23:07     ` Philippe Mathieu-Daudé
2026-11-13 16:11 ` [PATCH 10/19] target/mips: Fix nanoMIPS BPOSGE32C branch offset sign extension Philippe Mathieu-Daudé
2026-11-17 19:15   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 11/19] target/mips: Pass the right instruction size for nanoMIPS RESTORE.JRC Philippe Mathieu-Daudé
2026-11-17 19:15   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 12/19] target/mips: Fix nanoMIPS BC1EQZC/BC1NEZC always raising RI Philippe Mathieu-Daudé
2026-11-17 19:16   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 13/19] target/mips: Fix nanoMIPS BEQC16/BNEC16 corner cases Philippe Mathieu-Daudé
2026-11-17 19:18   ` Richard Henderson
2026-11-17 22:37     ` Philippe Mathieu-Daudé [this message]
2026-11-13 16:11 ` [PATCH 14/19] target/mips: Fix nanoMIPS BLTUC with rs == $zero Philippe Mathieu-Daudé
2026-11-17 19:20   ` Richard Henderson
2026-11-17 22:51     ` Philippe Mathieu-Daudé
2026-11-13 16:11 ` [PATCH 15/19] target/mips: Pass the nanoMIPS BREAK code to generate_exception_break() Philippe Mathieu-Daudé
2026-11-17 19:23   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 16/19] target/mips: Decode 6-bit bit number of nanoMIPS BBEQZC/BBNEZC Philippe Mathieu-Daudé
2026-11-17 19:24   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 17/19] target/mips: Don't set forbidden slot on never-taken nanoMIPS branches Philippe Mathieu-Daudé
2026-11-17 19:26   ` Richard Henderson
2026-11-17 22:59     ` Philippe Mathieu-Daudé
2026-11-13 16:11 ` [PATCH 18/19] target/mips: Do not sign-extend partial LWR results on Octeon Philippe Mathieu-Daudé
2026-11-17 19:29   ` Richard Henderson
2026-11-13 16:11 ` [PATCH 19/19] target/mips: Do not negate NaN results in NMADD.fmt and NMSUB.fmt Philippe Mathieu-Daudé
2026-11-17 19:37   ` Richard Henderson
2026-11-13 16:34 ` [PATCH 00/19] target/mips: Mixed bag of fixes Peter Maydell
2026-11-16  8:37   ` Philippe Mathieu-Daudé
2026-11-16  9:55     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4eafbdd-e5ac-453b-afab-2f0a0fdddfe4@oss.qualcomm.com \
    --to=philmd@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.