diff mbox series

[v6,2/7] target/riscv: rvv: Replace VSTART_CHECK_EARLY_EXIT in vext_ldst_us

Message ID 20240918171412.150107-3-max.chou@sifive.com
State New
Headers show
Series [v6,1/7] target/riscv: Set vdata.vm field for vector load/store whole register instructions | expand

Commit Message

Max Chou Sept. 18, 2024, 5:14 p.m. UTC
Because the real vl (evl) of vext_ldst_us may be different (e.g.
vlm.v/vsm.v/etc.), so the VSTART_CHECK_EARLY_EXIT checking function
should be replaced by checking evl in vext_ldst_us.

Signed-off-by: Max Chou <max.chou@sifive.com>
---
 target/riscv/vector_helper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniel Henrique Barboza Oct. 29, 2024, 6:59 p.m. UTC | #1
On 9/18/24 2:14 PM, Max Chou wrote:
> Because the real vl (evl) of vext_ldst_us may be different (e.g.
> vlm.v/vsm.v/etc.), so the VSTART_CHECK_EARLY_EXIT checking function
> should be replaced by checking evl in vext_ldst_us.
> 
> Signed-off-by: Max Chou <max.chou@sifive.com>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>   target/riscv/vector_helper.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
> index 87d2399c7e3..967bb2687ae 100644
> --- a/target/riscv/vector_helper.c
> +++ b/target/riscv/vector_helper.c
> @@ -276,7 +276,10 @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
>       uint32_t max_elems = vext_max_elems(desc, log2_esz);
>       uint32_t esz = 1 << log2_esz;
>   
> -    VSTART_CHECK_EARLY_EXIT(env);
> +    if (env->vstart >= evl) {
> +        env->vstart = 0;
> +        return;
> +    }
>   
>       /* load bytes from guest memory */
>       for (i = env->vstart; i < evl; env->vstart = ++i) {
diff mbox series

Patch

diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 87d2399c7e3..967bb2687ae 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -276,7 +276,10 @@  vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
     uint32_t max_elems = vext_max_elems(desc, log2_esz);
     uint32_t esz = 1 << log2_esz;
 
-    VSTART_CHECK_EARLY_EXIT(env);
+    if (env->vstart >= evl) {
+        env->vstart = 0;
+        return;
+    }
 
     /* load bytes from guest memory */
     for (i = env->vstart; i < evl; env->vstart = ++i) {