]> 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)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 24 Mar 2025 11:21:24 +0000 (14:21 +0300)
commit3cdd1f45aa55d77c6a04a546013de911eec3cced
treea02df49ccaf726395cfb25556230586833589867
parent7f5f3e5acd630c8b11b2a91f6d8ba2a0c6ab5524
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>
(cherry picked from commit 4e9e2478dfd26480bbf50367a67b9be0edafef2b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/riscv/vector_helper.c