[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v10 50/77] target/riscv: rvv-1.0: slide instructions
From: |
frank . chang |
Subject: |
[PATCH v10 50/77] target/riscv: rvv-1.0: slide instructions |
Date: |
Mon, 29 Nov 2021 11:03:10 +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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
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 f883fdf4749..d79f59e443e 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)); \
} \
}
--
2.25.1
- [PATCH v10 39/77] target/riscv: rvv-1.0: whole register move instructions, (continued)
- [PATCH v10 39/77] target/riscv: rvv-1.0: whole register move instructions, frank . chang, 2021/11/28
- [PATCH v10 38/77] target/riscv: rvv-1.0: floating-point scalar move instructions, frank . chang, 2021/11/28
- [PATCH v10 40/77] target/riscv: rvv-1.0: integer extension instructions, frank . chang, 2021/11/28
- [PATCH v10 41/77] target/riscv: rvv-1.0: single-width averaging add and subtract instructions, frank . chang, 2021/11/28
- [PATCH v10 42/77] target/riscv: rvv-1.0: single-width bit shift instructions, frank . chang, 2021/11/28
- [PATCH v10 43/77] target/riscv: rvv-1.0: integer add-with-carry/subtract-with-borrow, frank . chang, 2021/11/28
- [PATCH v10 44/77] target/riscv: rvv-1.0: narrowing integer right shift instructions, frank . chang, 2021/11/28
- [PATCH v10 46/77] target/riscv: rvv-1.0: single-width saturating add and subtract instructions, frank . chang, 2021/11/28
- [PATCH v10 47/77] target/riscv: rvv-1.0: integer comparison instructions, frank . chang, 2021/11/28
- [PATCH v10 49/77] target/riscv: rvv-1.0: mask-register logical instructions, frank . chang, 2021/11/28
- [PATCH v10 50/77] target/riscv: rvv-1.0: slide instructions,
frank . chang <=
- [PATCH v10 51/77] target/riscv: rvv-1.0: floating-point slide instructions, frank . chang, 2021/11/28
- [PATCH v10 54/77] target/riscv: rvv-1.0: widening floating-point reduction instructions, frank . chang, 2021/11/28
- [PATCH v10 55/77] target/riscv: rvv-1.0: single-width scaling shift instructions, frank . chang, 2021/11/28
- [PATCH v10 57/77] target/riscv: rvv-1.0: remove vmford.vv and vmford.vf, frank . chang, 2021/11/28
- [PATCH v10 58/77] target/riscv: rvv-1.0: remove integer extract instruction, frank . chang, 2021/11/28
- [PATCH v10 59/77] target/riscv: rvv-1.0: floating-point min/max instructions, frank . chang, 2021/11/28
- [PATCH v10 61/77] target/riscv: rvv-1.0: floating-point/integer type-convert instructions, frank . chang, 2021/11/28
- [PATCH v10 62/77] target/riscv: rvv-1.0: widening floating-point/integer type-convert, frank . chang, 2021/11/28
- [PATCH v10 63/77] target/riscv: add "set round to odd" rounding mode helper function, frank . chang, 2021/11/28
- [PATCH v10 60/77] target/riscv: introduce floating-point rounding mode enum, frank . chang, 2021/11/28