target/riscv: refactor VSTART_CHECK_EARLY_EXIT() to accept vl as a parameter

Some vector instructions are special, such as the vlm.v instruction,
where setting its vl actually sets evl = (vl + 7) >> 3. To improve
maintainability, we will uniformly use VSTART_CHECK_EARLY_EXIT() to
check for the condition vstart >= vl. This function will also handle
cases involving evl.

Fixes: df4252b2ec ("target/riscv/vector_helpers: do early exit when
vstart >= vl")
Signed-off-by: Chao Liu <lc00631@tecorigin.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <f575979874e323a9e0da7796aa391c7d87e56f88.1741573286.git.lc00631@tecorigin.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Chao Liu 2025-03-10 10:35:24 +08:00 committed by Alistair Francis
parent ec6411a525
commit e83845316a
4 changed files with 57 additions and 60 deletions

View file

@ -25,11 +25,11 @@
#include "tcg/tcg-gvec-desc.h"
#include "internals.h"
#define VSTART_CHECK_EARLY_EXIT(env) do { \
if (env->vstart >= env->vl) { \
env->vstart = 0; \
return; \
} \
#define VSTART_CHECK_EARLY_EXIT(env, vl) do { \
if (env->vstart >= vl) { \
env->vstart = 0; \
return; \
} \
} while (0)
static inline uint32_t vext_nf(uint32_t desc)
@ -159,7 +159,7 @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
uint32_t vma = vext_vma(desc); \
uint32_t i; \
\
VSTART_CHECK_EARLY_EXIT(env); \
VSTART_CHECK_EARLY_EXIT(env, vl); \
\
for (i = env->vstart; i < vl; i++) { \
if (!vm && !vext_elem_mask(v0, i)) { \