Provide a helper that calls ldst_host for all NF vectors.
Signed-off-by: Richard Henderson <[email protected]>
---
target/riscv/tcg/vector_helper.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/target/riscv/tcg/vector_helper.c b/target/riscv/tcg/vector_helper.c
index 9c0cbcac16..661f1ab2f6 100644
--- a/target/riscv/tcg/vector_helper.c
+++ b/target/riscv/tcg/vector_helper.c
@@ -329,6 +329,15 @@ static void vext_set_nf_elems_1s(void *vd, uint32_t i,
uint32_t nf,
}
}
+static void vext_ldst_nf_host(void *vd, void *host, uint32_t i, uint32_t nf,
+ uint32_t esz, uint32_t max_elems,
+ vext_ldst_elem_fn_host *ldst_host)
+{
+ for (uint32_t k = 0; k < nf; k++, host += esz) {
+ ldst_host(vd, i + k * max_elems, host);
+ }
+}
+
static void vext_ldst_nf_tlb(CPURISCVState *env, void *vd, target_ulong addr,
uint32_t i, uint32_t nf,
uint32_t esz, uint32_t max_elems,
@@ -413,7 +422,7 @@ vext_page_ldst_us(CPURISCVState *env, void *vd,
target_ulong addr,
vext_ldst_elem_fn_host *ldst_host, uintptr_t ra)
{
void *host;
- int i, k, flags;
+ int flags;
uint32_t esz = 1 << log2_esz;
uint32_t size = (elems * nf) << log2_esz;
uint32_t msize = nf * esz;
@@ -444,13 +453,9 @@ vext_page_ldst_us(CPURISCVState *env, void *vd,
target_ulong addr,
vext_continuous_ldst_host(env, ldst_host, vd, evl, env->vstart,
host, esz, is_load);
} else {
- for (i = env->vstart; i < evl; ++i) {
- k = 0;
- while (k < nf) {
- ldst_host(vd, i + k * max_elems, host);
- host += esz;
- k++;
- }
+ for (uint32_t i = env->vstart; i < evl; ++i) {
+ vext_ldst_nf_host(vd, host, i, nf, esz, max_elems, ldst_host);
+ host += msize;
}
}
env->vstart += elems;
@@ -459,7 +464,7 @@ vext_page_ldst_us(CPURISCVState *env, void *vd,
target_ulong addr,
vext_continuous_ldst_tlb(env, ldst_tlb, vd, evl, addr, env->vstart,
ra, esz, is_load);
} else {
- for (i = env->vstart; i < evl; env->vstart = ++i) {
+ 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;
--
2.43.0