Skip to content

Commit 3e09396

Browse files
LIU Zhiweialistair23
authored andcommitted
target/riscv: fix vector index load/store constraints
Although not explicitly specified that the the destination vector register groups cannot overlap the source vector register group, it is still necessary. And this constraint has been added to the v0.8 spec. Signed-off-by: LIU Zhiwei <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alistair Francis <[email protected]>
1 parent eabfeb0 commit 3e09396

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

target/riscv/insn_trans/trans_rvv.inc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,21 @@ static bool ld_index_op(DisasContext *s, arg_rnfvm *a, uint8_t seq)
513513
return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s);
514514
}
515515

516+
/*
517+
* For vector indexed segment loads, the destination vector register
518+
* groups cannot overlap the source vector register group (specified by
519+
* `vs2`), else an illegal instruction exception is raised.
520+
*/
516521
static bool ld_index_check(DisasContext *s, arg_rnfvm* a)
517522
{
518523
return (vext_check_isa_ill(s) &&
519524
vext_check_overlap_mask(s, a->rd, a->vm, false) &&
520525
vext_check_reg(s, a->rd, false) &&
521526
vext_check_reg(s, a->rs2, false) &&
522-
vext_check_nf(s, a->nf));
527+
vext_check_nf(s, a->nf) &&
528+
((a->nf == 1) ||
529+
vext_check_overlap_group(a->rd, a->nf << s->lmul,
530+
a->rs2, 1 << s->lmul)));
523531
}
524532

525533
GEN_VEXT_TRANS(vlxb_v, 0, rnfvm, ld_index_op, ld_index_check)

0 commit comments

Comments
 (0)