On Wed, Mar 04, 2026 at 09:25:08PM +0800, Max Chou wrote: > Replace the same vill reset flow by reset_ill_vtype function. > Clean refactoring. LGTM.
Reviewed-by: Chao Liu <[email protected]> Best regards, Chao Liu > Reviewed-by: Daniel Henrique Barboza <[email protected]> > Signed-off-by: Max Chou <[email protected]> > --- > target/riscv/vector_helper.c | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > > diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c > index 7575e24084..b7105627ed 100644 > --- a/target/riscv/vector_helper.c > +++ b/target/riscv/vector_helper.c > @@ -49,6 +49,15 @@ static target_ulong vtype_reserved(CPURISCVState *env, > target_ulong vtype) > return reserved; > } > > +static inline void reset_ill_vtype(CPURISCVState *env) > +{ > + /* only set vill bit. */ > + env->vill = 1; > + env->vtype = 0; > + env->vl = 0; > + env->vstart = 0; > +} > + > target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1, > target_ulong s2, target_ulong x0) > { > @@ -93,11 +102,7 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, > target_ulong s1, > } > > if ((sew > cpu->cfg.elen) || vill || (vtype_reserved(env, s2) != 0)) { > - /* only set vill bit. */ > - env->vill = 1; > - env->vtype = 0; > - env->vl = 0; > - env->vstart = 0; > + reset_ill_vtype(env); > return 0; > } > > @@ -113,11 +118,7 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, > target_ulong s1, > } > > if (cpu->cfg.rvv_vsetvl_x0_vill && x0 && (env->vl != vl)) { > - /* only set vill bit. */ > - env->vill = 1; > - env->vtype = 0; > - env->vl = 0; > - env->vstart = 0; > + reset_ill_vtype(env); > return 0; > } > > -- > 2.52.0 >
