summaryrefslogtreecommitdiff
path: root/target/riscv/vector_helper.c
diff options
context:
space:
mode:
authorFrank Chang <frank.chang@sifive.com>2021-12-10 15:56:36 +0800
committerAlistair Francis <alistair.francis@wdc.com>2021-12-20 14:53:22 +1000
commit6438ed61de22d9fb945452b5fe5b0ea594aa8ccc (patch)
tree5059e81eacbc121964cc82bbc4f0ad901350eff1 /target/riscv/vector_helper.c
parent50f6696c0f87372348b0760f858187cda3e7eb7f (diff)
downloadqemu-6438ed61de22d9fb945452b5fe5b0ea594aa8ccc.zip
target/riscv: rvv-1.0: slide instructions
* Remove clear function from helper functions as the tail elements are unchanged in RVV 1.0. Signed-off-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211210075704.23951-51-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/vector_helper.c')
-rw-r--r--target/riscv/vector_helper.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index f883fdf474..d79f59e443 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -4430,17 +4430,22 @@ GEN_VEXT_VSLIDEUP_VX(vslideup_vx_d, uint64_t, H8)
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
CPURISCVState *env, uint32_t desc) \
{ \
- uint32_t vlmax = env_archcpu(env)->cfg.vlen; \
+ uint32_t vlmax = vext_max_elems(desc, ctzl(sizeof(ETYPE))); \
uint32_t vm = vext_vm(desc); \
uint32_t vl = env->vl; \
- target_ulong offset = s1, i; \
+ target_ulong i_max, i; \
\
- for (i = 0; i < vl; ++i) { \
- target_ulong j = i + offset; \
- if (!vm && !vext_elem_mask(v0, i)) { \
- continue; \
+ i_max = MIN(s1 < vlmax ? vlmax - s1 : 0, vl); \
+ for (i = 0; i < i_max; ++i) { \
+ if (vm || vext_elem_mask(v0, i)) { \
+ *((ETYPE *)vd + H(i)) = *((ETYPE *)vs2 + H(i + s1)); \
+ } \
+ } \
+ \
+ for (i = i_max; i < vl; ++i) { \
+ if (vm || vext_elem_mask(v0, i)) { \
+ *((ETYPE *)vd + H(i)) = 0; \
} \
- *((ETYPE *)vd + H(i)) = j >= vlmax ? 0 : *((ETYPE *)vs2 + H(j)); \
} \
}