[PATCH v2 10/23] target/riscv: Split out vext_ldst_us_notail

Richard Henderson <[email protected]>
Newsgroups org.nongnu.qemu-riscv,org.nongnu.qemu-devel
Message-ID <[email protected]>
Split out vext_ldst_us_tail that doesn't use 'desc'.

Signed-off-by: Richard Henderson <[email protected]>
---
 target/riscv/tcg/vector_helper.c | 34 +++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/target/riscv/tcg/vector_helper.c b/target/riscv/tcg/vector_helper.c
index abfd2ec45d..76f3babed6 100644
--- a/target/riscv/tcg/vector_helper.c
+++ b/target/riscv/tcg/vector_helper.c
@@ -472,14 +472,14 @@ static void vext_test_alignment(CPURISCVState *env, vaddr addr, uint32_t esz,
 }
 
 static inline QEMU_ALWAYS_INLINE void
-vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
-             vext_ldst_elem_fn_tlb *ldst_tlb,
-             vext_ldst_elem_fn_host *ldst_host, uint32_t log2_esz,
-             uint32_t evl, uintptr_t ra, bool is_load)
+vext_ldst_us_notail(void *vd, target_ulong base, CPURISCVState *env,
+                    uint32_t log2_esz, uint32_t nf, uint32_t evl,
+                    uint32_t max_elems, bool vma,
+                    vext_ldst_elem_fn_tlb *ldst_tlb,
+                    vext_ldst_elem_fn_host *ldst_host,
+                    uintptr_t ra, bool is_load)
 {
     target_ulong elems, addr, last, last_in_page, page_split;
-    uint32_t nf = vext_nf(desc);
-    uint32_t max_elems = vext_max_elems(desc, log2_esz);
     uint32_t esz = 1 << log2_esz;
     uint32_t msize = nf * esz;
     int mmu_index = riscv_env_mmu_index(env, false);
@@ -503,7 +503,7 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
         for (; i < evl; env->vstart = ++i, addr += esz) {
             ldst_tlb(env, adjust_addr(env, addr), i, vd, ra);
         }
-        goto tail;
+        return;
     }
 #endif
 
@@ -535,7 +535,7 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
 
         /* Usually the first page contains the entire vector. */
         if (likely(page_evl == evl)) {
-            goto tail;
+            return;
         }
         env->vstart = i = page_evl;
         addr += elems * msize;
@@ -545,7 +545,7 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
     if (unlikely(page_split % msize)) {
         vext_ldst_nf_tlb(env, vd, addr, i++, nf, esz, max_elems, ldst_tlb, ra);
         if (i == evl) {
-            goto tail;
+            return;
         }
         env->vstart = i;
         addr += msize;
@@ -564,10 +564,22 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
         vext_page_ldst_us_tlb(env, vd, addr, i, evl, nf, log2_esz, max_elems,
                               ldst_tlb, mmu_index, ra);
     }
+}
+
+static inline QEMU_ALWAYS_INLINE void
+vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
+             vext_ldst_elem_fn_tlb *ldst_tlb,
+             vext_ldst_elem_fn_host *ldst_host, uint32_t log2_esz,
+             uint32_t evl, uintptr_t ra, bool is_load)
+{
+    uint32_t nf = vext_nf(desc);
+    uint32_t max_elems = vext_max_elems(desc, log2_esz);
+
+    vext_ldst_us_notail(vd, base, env, log2_esz, vext_nf(desc), evl, max_elems,
+                        vext_vma(desc), ldst_tlb, ldst_host, ra, is_load);
 
- tail:
     env->vstart = 0;
-    vext_set_tail_elems_1s(evl, vd, desc, nf, esz, max_elems);
+    vext_set_tail_elems_1s(evl, vd, desc, nf, 1 << log2_esz, max_elems);
 }
 
 /*
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.