]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/riscv: fix handling of nop for vstart >= vl in some vector instruction
authorChao Liu <lc00631@tecorigin.com>
Mon, 10 Mar 2025 02:35:25 +0000 (10:35 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Wed, 19 Mar 2025 06:40:42 +0000 (16:40 +1000)
commit4e9e2478dfd26480bbf50367a67b9be0edafef2b
treed4ed75d1710e00dd845b17a434024eb784fc8bf1
parente83845316abcea9024eb5402a6c5eb8b092c79d5
target/riscv: fix handling of nop for vstart >= vl in some vector instruction

Recently, when I was writing a RISCV test, I found that when VL is set to 0, the
instruction should be nop, but when I tested it, I found that QEMU will treat
all elements as tail elements, and in the case of VTA=1, write all elements
to 1.

After troubleshooting, it was found that the vext_vx_rm_1 function was called in
the vext_vx_rm_2, and then the vext_set_elems_1s function was called to process
the tail element, but only VSTART >= vl was checked in the vext_vx_rm_1
function, which caused the tail element to still be processed even if it was
returned in advance.

So I've made the following change:

Put VSTART_CHECK_EARLY_EXIT(env) at the beginning of the vext_vx_rm_2 function,
so that the VSTART register is checked correctly.

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: <b2649f14915150be4c602d63cd3ea4adf47e9d75.1741573286.git.lc00631@tecorigin.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/vector_helper.c