You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/include/tcg
Huang Shiyuan f63e7089b4 tcg/riscv: Add basic support for vector
The RISC-V vector instruction set utilizes the LMUL field to group
multiple registers, enabling variable-length vector registers. This
implementation uses only the first register number of each group while
reserving the other register numbers within the group.

In TCG, each VEC_IR can have 3 types (TCG_TYPE_V64/128/256), and the
host runtime needs to adjust LMUL based on the type to use different
register groups.

This presents challenges for TCG's register allocation. Currently, we
avoid modifying the register allocation part of TCG and only expose the
minimum number of vector registers.

For example, when the host vlen is 64 bits and type is TCG_TYPE_V256, with
LMUL equal to 4, we use 4 vector registers as one register group. We can
use a maximum of 8 register groups, but the V0 register number is reserved
as a mask register, so we can effectively use at most 7 register groups.
Moreover, when type is smaller than TCG_TYPE_V256, only 7 registers are
forced to be used. This is because TCG cannot yet dynamically constrain
registers with type; likewise, when the host vlen is 128 bits and
TCG_TYPE_V256, we can use at most 15 registers.

There is not much pressure on vector register allocation in TCG now, so
using 7 registers is feasible and will not have a major impact on code
generation.

This patch:
1. Reserves vector register 0 for use as a mask register.
2. When using register groups, reserves the additional registers within
   each group.

Signed-off-by: Huang Shiyuan <swung0x48@outlook.com>
Co-authored-by: TANG Tiancheng <tangtiancheng.ttc@alibaba-inc.com>
Signed-off-by: TANG Tiancheng <tangtiancheng.ttc@alibaba-inc.com>
Reviewed-by: Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20241007025700.47259-3-zhiwei_liu@linux.alibaba.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
1 month ago
..
debug-assert.h tcg: Split out tcg/debug-assert.h 2 years ago
debuginfo.h accel/tcg: Move perf and debuginfo support to tcg/ 10 months ago
helper-info.h tcg: Make tcg/helper-info.h self-contained 7 months ago
insn-start-words.h tcg: Add insn_start_words to TCGContext 2 years ago
oversized-guest.h tcg: Split out tcg/oversized-guest.h 2 years ago
perf.h accel/tcg: Move perf and debuginfo support to tcg/ 10 months ago
startup.h tcg: Split out tcg init functions to tcg/startup.h 1 year ago
tcg-cond.h tcg: Introduce TCG_COND_TST{EQ,NE} 10 months ago
tcg-gvec-desc.h tcg: Adjust simd_desc size encoding 4 years ago
tcg-ldst.h accel/tcg: Widen tcg-ldst.h addresses to uint64_t 2 years ago
tcg-mo.h tcg: Move TCG headers to include/tcg/ 5 years ago
tcg-op-common.h tcg: Remove INDEX_op_plugin_cb_{start,end} 7 months ago
tcg-op-gvec-common.h tcg: Add write_aofs to GVecGen3i 7 months ago
tcg-op-gvec.h tcg: Split tcg/tcg-op-gvec.h 2 years ago
tcg-op.h tcg: Export tcg_gen_ext_{i32,i64,tl} 1 year ago
tcg-opc.h tcg: Remove INDEX_op_plugin_cb_{start,end} 7 months ago
tcg-temp-internal.h tcg: Move tcg_temp_free_* out of line 1 year ago
tcg.h tcg/riscv: Add basic support for vector 1 month ago