On Thu, 2026-08-20 at 21:03 -0700, Richard Henderson wrote:
> Drop the usage in vext_page_ldst_us, merging the nf == 1
> case into the vext_ldst_nf_tlb loop.
> Inline it into the last use in vext_ldst_us.
> 
> Signed-off-by: Richard Henderson <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> ---
>  target/riscv/tcg/vector_helper.c | 34 ++++++++++--------------------
> --
>  1 file changed, 10 insertions(+), 24 deletions(-)
> 
> diff --git a/target/riscv/tcg/vector_helper.c
> b/target/riscv/tcg/vector_helper.c
> index da1e704c56..63a51f2b48 100644
> --- a/target/riscv/tcg/vector_helper.c
> +++ b/target/riscv/tcg/vector_helper.c
> @@ -272,17 +272,6 @@ GEN_VEXT_HOST_ST_ELEM(ste_h, uint16_t, H2,
> stw_le)
>  GEN_VEXT_HOST_ST_ELEM(ste_w, uint32_t, H4, stl_le)
>  GEN_VEXT_HOST_ST_ELEM(ste_d, uint64_t, H8, stq_le)
>  
> -static inline QEMU_ALWAYS_INLINE void
> -vext_continuous_ldst_tlb(CPURISCVState *env, vext_ldst_elem_fn_tlb
> *ldst_tlb,
> -                         void *vd, uint32_t evl, target_ulong addr,
> -                         uint32_t reg_start, uintptr_t ra, uint32_t
> esz)
> -{
> -    uint32_t i;
> -    for (i = env->vstart; i < evl; env->vstart = ++i, addr += esz) {
> -        ldst_tlb(env, adjust_addr(env, addr), i, vd, ra);
> -    }
> -}
> -
>  static inline QEMU_ALWAYS_INLINE void
>  vext_continuous_ldst_host(CPURISCVState *env, vext_ldst_elem_fn_host
> *ldst_host,
>                          void *vd, uint32_t evl, uint32_t reg_start,
> void *host,
> @@ -465,15 +454,10 @@ vext_page_ldst_us(CPURISCVState *env, void *vd,
> target_ulong addr,
>          }
>          env->vstart += elems;
>      } else {
> -        if (nf == 1) {
> -            vext_continuous_ldst_tlb(env, ldst_tlb, vd, evl, addr,
> -                                     env->vstart, ra, esz);
> -        } else {
> -            for (uint32_t i = env->vstart; i < evl; env->vstart =
> ++i) {
> -                vext_ldst_nf_tlb(env, vd, addr, i, nf, esz,
> -                                 max_elems, ldst_tlb, ra);
> -                addr += msize;
> -            }
> +        for (uint32_t i = env->vstart; i < evl; env->vstart = ++i) {
> +            vext_ldst_nf_tlb(env, vd, addr, i, nf, esz,
> +                             max_elems, ldst_tlb, ra);
> +            addr += msize;
>          }
>      }
>  }
> @@ -495,13 +479,15 @@ vext_ldst_us(void *vd, target_ulong base,
> CPURISCVState *env, uint32_t desc,
>  
>  #if defined(CONFIG_USER_ONLY)
>      /*
> -     * For data sizes <= 6 bytes we get better performance by simply
> calling
> -     * vext_continuous_ldst_tlb
> +     * For data sizes <= 6 bytes we get better performance
> +     * by simply calling ldst_tlb.
>       */
>      if (nf == 1 && (evl << log2_esz) <= 6) {
>          addr = base + (env->vstart << log2_esz);
> -        vext_continuous_ldst_tlb(env, ldst_tlb, vd, evl, addr,
> -                                 env->vstart, ra, esz);
> +        for (uint32_t i = env->vstart; i < evl;
> +             env->vstart = ++i, addr += esz) {
> +            ldst_tlb(env, adjust_addr(env, addr), i, vd, ra);
> +        }
>          env->vstart = 0;
>          vext_set_tail_elems_1s(evl, vd, desc, nf, esz, max_elems);
>          return;

Reply via email to