[PATCH 1/5] target/mips: Remove duplicated check_cp0_enabled() calls in gen_cp0()

Philippe Mathieu-Daudé posted 5 patches 4 years, 9 months ago
Maintainers: Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Aurelien Jarno <aurelien@aurel32.net>
[PATCH 1/5] target/mips: Remove duplicated check_cp0_enabled() calls in gen_cp0()
Posted by Philippe Mathieu-Daudé 4 years, 9 months ago
We already check for CP0 enabled at the beginning of gen_cp0(),
no need to check it again after.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/translate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index 5dad75cdf37..9acca6ef045 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -9477,7 +9477,6 @@ static void gen_cp0(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
         opn = "mthc0";
         break;
     case OPC_MFTR:
-        check_cp0_enabled(ctx);
         if (rd == 0) {
             /* Treat as NOP. */
             return;
@@ -9487,7 +9486,6 @@ static void gen_cp0(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
         opn = "mftr";
         break;
     case OPC_MTTR:
-        check_cp0_enabled(ctx);
         gen_mttr(env, ctx, rd, rt, (ctx->opcode >> 5) & 1,
                  ctx->opcode & 0x7, (ctx->opcode >> 4) & 1);
         opn = "mttr";
-- 
2.26.3

Re: [PATCH 1/5] target/mips: Remove duplicated check_cp0_enabled() calls in gen_cp0()
Posted by Richard Henderson 4 years, 9 months ago
On 4/20/21 12:34 PM, Philippe Mathieu-Daudé wrote:
> We already check for CP0 enabled at the beginning of gen_cp0(),
> no need to check it again after.
> 
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
>   target/mips/translate.c | 2 --
>   1 file changed, 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH 1/5] target/mips: Remove duplicated check_cp0_enabled() calls in gen_cp0()
Posted by Richard Henderson 4 years, 9 months ago
On 4/20/21 12:34 PM, Philippe Mathieu-Daudé wrote:
> We already check for CP0 enabled at the beginning of gen_cp0(),
> no need to check it again after.
> 
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
>   target/mips/translate.c | 2 --
>   1 file changed, 2 deletions(-)

Having noticed the default case for the nanomips decode, I do wonder if having 
the cp0 check happen before the switch in gen_cp0 is actually correct.


r~