Skip to contentSkip to conversation

target/loongarch: Remove avail_64 in trans_srai_w()

PATCH Superseded Feiyang Chen 2 participants 2 messages Jun 17, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/loongarch: Remove avail_64 in trans_srai_w()

Since srai.w is a valid instruction on la32, simply remove the avail_64 check.

Fixes c0c0461e3a06 ("target/loongarch: Add avail_64 to check la64-only instructions")
---
 target/loongarch/tcg/insn_trans/trans_shift.c.inc | 4 ----
 1 file changed, 4 deletions(-)
target/loongarch/tcg/insn_trans/trans_shift.c.inc +0 -4
index 2f4bd6ff28..8bcf341b22 100644
@@ -72,10 +72,6 @@ static bool trans_srai_w(DisasContext *ctx, arg_srai_w *a)
     TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
     TCGv src1 = gpr_src(ctx, a->rj, EXT_ZERO);
 
-    if (!avail_64(ctx)) {
-        return false;
-    }
-
     tcg_gen_sextract_tl(dest, src1, a->imm, 32 - a->imm);
     gen_set_gpr(a->rd, dest, EXT_NONE);
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Feiyang Chen

Since srai.w is a valid instruction on la32, simply remove the avail_64 check.

Fixes c0c0461e3a06 ("target/loongarch: Add avail_64 to check la64-only instructions")
---
  target/loongarch/tcg/insn_trans/trans_shift.c.inc | 4 ----
  1 file changed, 4 deletions(-)
target/loongarch/tcg/insn_trans/trans_shift.c.inc +0 -0
index 2f4bd6ff28..8bcf341b22 100644

target/loongarch/tcg/insn_trans/trans_shift.c.inc static bool trans_srai_w(DisasContext *ctx, arg_srai_w *a) · line 77

Quoted 10 lines
target/loongarch/tcg/insn_trans/trans_shift.c.inc +0 -4
@@ -72,10 +72,6 @@ static bool trans_srai_w(DisasContext *ctx, arg_srai_w *a)
      TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
      TCGv src1 = gpr_src(ctx, a->rj, EXT_ZERO);
 
-    if (!avail_64(ctx)) {
-        return false;
-    }
-
      tcg_gen_sextract_tl(dest, src1, a->imm, 32 - a->imm);
      gen_set_gpr(a->rd, dest, EXT_NONE);
 

For the bug fix alone:

I'm not sure why this trans function is handled specially. I think this would be better as

static void gen_sari_w(TCGv dest, TCGv src1, target_long imm)

{
    tcg_gen_sextract_tl(dest, src1, imm, 32 - imm);
}

TRANS(sari_w, ALL, gen_rri_c, EXT_NONE, EXT_NONE, gen_sari_w)

r~