[PATCH] target/riscv: Fix vslidedown with rvv_ta_all_1s

Anton Blanchard posted 1 patch 4 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250414213006.3509058-1-antonb@tenstorrent.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
target/riscv/vector_helper.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] target/riscv: Fix vslidedown with rvv_ta_all_1s
Posted by Anton Blanchard 4 weeks, 1 day ago
vslidedown always zeroes elements past vl, where it should use the
tail policy.

Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
---
 target/riscv/vector_helper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 67b3bafebb..1012d38c8a 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -5113,9 +5113,11 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2,         \
     }                                                                     \
                                                                           \
     for (i = i_max; i < vl; ++i) {                                        \
-        if (vm || vext_elem_mask(v0, i)) {                                \
-            *((ETYPE *)vd + H(i)) = 0;                                    \
+        if (!vm && !vext_elem_mask(v0, i)) {                              \
+            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);           \
+            continue;                                                     \
         }                                                                 \
+        *((ETYPE *)vd + H(i)) = 0;                                        \
     }                                                                     \
                                                                           \
     env->vstart = 0;                                                      \
-- 
2.34.1
Re: [PATCH] target/riscv: Fix vslidedown with rvv_ta_all_1s
Posted by Alistair Francis 2 weeks, 5 days ago
On Tue, Apr 15, 2025 at 7:31 AM Anton Blanchard <antonb@tenstorrent.com> wrote:
>
> vslidedown always zeroes elements past vl, where it should use the
> tail policy.
>
> Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  target/riscv/vector_helper.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
> index 67b3bafebb..1012d38c8a 100644
> --- a/target/riscv/vector_helper.c
> +++ b/target/riscv/vector_helper.c
> @@ -5113,9 +5113,11 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2,         \
>      }                                                                     \
>                                                                            \
>      for (i = i_max; i < vl; ++i) {                                        \
> -        if (vm || vext_elem_mask(v0, i)) {                                \
> -            *((ETYPE *)vd + H(i)) = 0;                                    \
> +        if (!vm && !vext_elem_mask(v0, i)) {                              \
> +            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);           \
> +            continue;                                                     \
>          }                                                                 \
> +        *((ETYPE *)vd + H(i)) = 0;                                        \
>      }                                                                     \
>                                                                            \
>      env->vstart = 0;                                                      \
> --
> 2.34.1
>
>
Re: [PATCH] target/riscv: Fix vslidedown with rvv_ta_all_1s
Posted by Alistair Francis 2 weeks, 5 days ago
On Tue, Apr 15, 2025 at 7:31 AM Anton Blanchard <antonb@tenstorrent.com> wrote:
>
> vslidedown always zeroes elements past vl, where it should use the
> tail policy.
>
> Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/vector_helper.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
> index 67b3bafebb..1012d38c8a 100644
> --- a/target/riscv/vector_helper.c
> +++ b/target/riscv/vector_helper.c
> @@ -5113,9 +5113,11 @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2,         \
>      }                                                                     \
>                                                                            \
>      for (i = i_max; i < vl; ++i) {                                        \
> -        if (vm || vext_elem_mask(v0, i)) {                                \
> -            *((ETYPE *)vd + H(i)) = 0;                                    \
> +        if (!vm && !vext_elem_mask(v0, i)) {                              \
> +            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);           \
> +            continue;                                                     \
>          }                                                                 \
> +        *((ETYPE *)vd + H(i)) = 0;                                        \
>      }                                                                     \
>                                                                            \
>      env->vstart = 0;                                                      \
> --
> 2.34.1
>
>