[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v4 52/70] target/riscv: rvv-1.0: slide instructions
From: |
frank . chang |
Subject: |
[RFC v4 52/70] target/riscv: rvv-1.0: slide instructions |
Date: |
Mon, 17 Aug 2020 16:49:37 +0800 |
From: Frank Chang <frank.chang@sifive.com>
* 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>
---
target/riscv/vector_helper.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index ea1715b5484..2f1460b624d 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -4689,17 +4689,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)); \
} \
}
--
2.17.1
- Re: [RFC v4 46/70] target/riscv: rvv-1.0: quad-widening integer multiply-add instructions, (continued)
- [RFC v4 47/70] target/riscv: rvv-1.0: single-width saturating add and subtract instructions, frank . chang, 2020/08/17
- [RFC v4 48/70] target/riscv: rvv-1.0: integer comparison instructions, frank . chang, 2020/08/17
- [RFC v4 49/70] target/riscv: use softfloat lib float16 comparison functions, frank . chang, 2020/08/17
- [RFC v4 50/70] target/riscv: rvv-1.0: floating-point compare instructions, frank . chang, 2020/08/17
- [RFC v4 51/70] target/riscv: rvv-1.0: mask-register logical instructions, frank . chang, 2020/08/17
- [RFC v4 52/70] target/riscv: rvv-1.0: slide instructions,
frank . chang <=
- [RFC v4 53/70] target/riscv: rvv-1.0: floating-point slide instructions, frank . chang, 2020/08/17
- [RFC v4 54/70] target/riscv: rvv-1.0: narrowing fixed-point clip instructions, frank . chang, 2020/08/17
- [RFC v4 55/70] target/riscv: rvv-1.0: single-width floating-point reduction, frank . chang, 2020/08/17
- [RFC v4 56/70] target/riscv: rvv-1.0: widening floating-point reduction instructions, frank . chang, 2020/08/17