[PATCH v6 7/9] trans_rvv.c.inc: remove redundant mark_vs_dirty() calls

Daniel Henrique Barboza posted 9 patches 9 months, 1 week ago
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
There is a newer version of this series
[PATCH v6 7/9] trans_rvv.c.inc: remove redundant mark_vs_dirty() calls
Posted by Daniel Henrique Barboza 9 months, 1 week ago
trans_vmv_v_i , trans_vfmv_v_f and the trans_##NAME macro from
GEN_VMV_WHOLE_TRANS() are calling mark_vs_dirty() in both branches of
their 'ifs'. conditionals.

Call it just once in the end like other functions are doing.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/riscv/insn_trans/trans_rvv.c.inc | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
index 69f32d081e..db08efa278 100644
--- a/target/riscv/insn_trans/trans_rvv.c.inc
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
@@ -2044,7 +2044,6 @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
         if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
             tcg_gen_gvec_dup_imm(s->sew, vreg_ofs(s, a->rd),
                                  MAXSZ(s), MAXSZ(s), simm);
-            mark_vs_dirty(s);
         } else {
             TCGv_i32 desc;
             TCGv_i64 s1;
@@ -2062,9 +2061,8 @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
                                               s->cfg_ptr->vlenb, data));
             tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd));
             fns[s->sew](dest, s1, tcg_env, desc);
-
-            mark_vs_dirty(s);
         }
+        mark_vs_dirty(s);
         return true;
     }
     return false;
@@ -2591,7 +2589,6 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
 
             tcg_gen_gvec_dup_i64(s->sew, vreg_ofs(s, a->rd),
                                  MAXSZ(s), MAXSZ(s), t1);
-            mark_vs_dirty(s);
         } else {
             TCGv_ptr dest;
             TCGv_i32 desc;
@@ -2614,9 +2611,8 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
             tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd));
 
             fns[s->sew - 1](dest, t1, tcg_env, desc);
-
-            mark_vs_dirty(s);
         }
+        mark_vs_dirty(s);
         return true;
     }
     return false;
@@ -3524,12 +3520,11 @@ static bool trans_##NAME(DisasContext *s, arg_##NAME * a)               \
         if (s->vstart_eq_zero) {                                        \
             tcg_gen_gvec_mov(s->sew, vreg_ofs(s, a->rd),                \
                              vreg_ofs(s, a->rs2), maxsz, maxsz);        \
-            mark_vs_dirty(s);                                           \
         } else {                                                        \
             tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs2), \
                                tcg_env, maxsz, maxsz, 0, gen_helper_vmvr_v); \
-            mark_vs_dirty(s);                                           \
         }                                                               \
+        mark_vs_dirty(s);                                               \
         return true;                                                    \
     }                                                                   \
     return false;                                                       \
-- 
2.43.2
Re: [PATCH v6 7/9] trans_rvv.c.inc: remove redundant mark_vs_dirty() calls
Posted by Alistair Francis 8 months, 3 weeks ago
On Thu, Feb 22, 2024 at 7:33 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> trans_vmv_v_i , trans_vfmv_v_f and the trans_##NAME macro from
> GEN_VMV_WHOLE_TRANS() are calling mark_vs_dirty() in both branches of
> their 'ifs'. conditionals.
>
> Call it just once in the end like other functions are doing.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/insn_trans/trans_rvv.c.inc | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
> index 69f32d081e..db08efa278 100644
> --- a/target/riscv/insn_trans/trans_rvv.c.inc
> +++ b/target/riscv/insn_trans/trans_rvv.c.inc
> @@ -2044,7 +2044,6 @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
>          if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
>              tcg_gen_gvec_dup_imm(s->sew, vreg_ofs(s, a->rd),
>                                   MAXSZ(s), MAXSZ(s), simm);
> -            mark_vs_dirty(s);
>          } else {
>              TCGv_i32 desc;
>              TCGv_i64 s1;
> @@ -2062,9 +2061,8 @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
>                                                s->cfg_ptr->vlenb, data));
>              tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd));
>              fns[s->sew](dest, s1, tcg_env, desc);
> -
> -            mark_vs_dirty(s);
>          }
> +        mark_vs_dirty(s);
>          return true;
>      }
>      return false;
> @@ -2591,7 +2589,6 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
>
>              tcg_gen_gvec_dup_i64(s->sew, vreg_ofs(s, a->rd),
>                                   MAXSZ(s), MAXSZ(s), t1);
> -            mark_vs_dirty(s);
>          } else {
>              TCGv_ptr dest;
>              TCGv_i32 desc;
> @@ -2614,9 +2611,8 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
>              tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, a->rd));
>
>              fns[s->sew - 1](dest, t1, tcg_env, desc);
> -
> -            mark_vs_dirty(s);
>          }
> +        mark_vs_dirty(s);
>          return true;
>      }
>      return false;
> @@ -3524,12 +3520,11 @@ static bool trans_##NAME(DisasContext *s, arg_##NAME * a)               \
>          if (s->vstart_eq_zero) {                                        \
>              tcg_gen_gvec_mov(s->sew, vreg_ofs(s, a->rd),                \
>                               vreg_ofs(s, a->rs2), maxsz, maxsz);        \
> -            mark_vs_dirty(s);                                           \
>          } else {                                                        \
>              tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs2), \
>                                 tcg_env, maxsz, maxsz, 0, gen_helper_vmvr_v); \
> -            mark_vs_dirty(s);                                           \
>          }                                                               \
> +        mark_vs_dirty(s);                                               \
>          return true;                                                    \
>      }                                                                   \
>      return false;                                                       \
> --
> 2.43.2
>
>