]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/riscv: rvv: Handle source overlap of vector widening reduction instructions
authorAnton Blanchard <antonb@tenstorrent.com>
Fri, 17 Apr 2026 08:03:28 +0000 (08:03 +0000)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 21 May 2026 23:45:46 +0000 (09:45 +1000)
Widening reductions read vs2 as a vector of SEW elements and vs1[0] as a
scalar of 2*SEW. The ISA does not allow the same vector register to be read
with different EEWs, so they must not overlap.

vs1 is read as a scalar from element 0, so it is treated as a single vector
register (independent of LMUL) when checking overlap.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3208
Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260417080328.31918-1-antonb@tenstorrent.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/insn_trans/trans_rvv.c.inc

index e65356eb7c5d713b4389d516ebb5ccc9833cee6f..0b41cecb27f4ebebefbc71d480c6481569986f75 100644 (file)
@@ -3283,6 +3283,7 @@ GEN_OPIVV_TRANS(vredxor_vs, reduction_check)
 static bool reduction_widen_check(DisasContext *s, arg_rmrr *a)
 {
     return reduction_check(s, a) && (s->sew < MO_64) &&
+           !is_overlapped(a->rs1, 1, a->rs2, 1 << MAX(s->lmul, 0)) &&
            ((s->sew + 1) <= (s->cfg_ptr->elen >> 4));
 }