On 10/21/25 9:57 PM, Kito Cheng wrote:
This patch implements the standard fixed-length vector calling convention
variant as specified in the RISC-V ELF psABI document. The implementation
introduces ABI_VLEN to serve as the minimal VLEN for fixed-length vectors.
For example, int32x8_t is a 256-bit vector type. If ABI_VLEN is 128, it
will be passed in two vector registers as LMUL 2. If ABI_VLEN is larger
than 256, it will be passed in one vector register as LMUL 1.
This differs from the minimal VLEN (defined by ZVL*B extension) to ensure
ABI stability when the program compiles with different VLEN/ZVL*B settings.
Change since v1:
- Adding check_only parameter for several functions to make sure we
won't emit warnings during checking function ABI.
Ref: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/418
gcc/ChangeLog:
* config/riscv/riscv.h (enum riscv_cc): Add RISCV_CC_VLS_V_32,
RISCV_CC_VLS_V_64, RISCV_CC_VLS_V_128, RISCV_CC_VLS_V_256,
RISCV_CC_VLS_V_512, RISCV_CC_VLS_V_1024, RISCV_CC_VLS_V_2048,
RISCV_CC_VLS_V_4096, RISCV_CC_VLS_V_8192, RISCV_CC_VLS_V_16384.
(CUMULATIVE_ARGS): Add abi_vlen field.
* config/riscv/riscv.cc (riscv_handle_rvv_vls_cc_attribute): New
function.
(riscv_gnu_attributes): Add vls_cc attribute entry.
(riscv_attributes): Add riscv_vls_cc attribute entry.
(riscv_flatten_aggregate_field): Add vls_p and abi_vlen parameters
to handle VLS vector types.
(riscv_flatten_aggregate_argument): Update call to
riscv_flatten_aggregate_field.
(riscv_get_vector_arg): Add vls_p parameter for VLS handling.
(riscv_vls_cc_p): New function.
(riscv_get_cc_abi_vlen): New function.
(riscv_valid_abi_vlen_vls_cc_p): New function.
(riscv_get_riscv_cc_by_abi_vlen): New function.
(riscv_get_vls_container_type): New function.
(riscv_pass_vls_in_vr): New function.
(riscv_pass_aggregate_in_vr): New function.
(riscv_get_arg_info): Add VLS calling convention handling.
(riscv_function_arg_advance): Update for VLS calling convention.
(riscv_return_in_memory): Add fntype parameter and initialize
cumulative args properly.
(riscv_v_abi): Add abi parameter.
(riscv_get_vls_cc_attr): New function.
(riscv_vls_cc_function_abi): New function.
(riscv_fntype_abi): Add VLS calling convention detection.
(riscv_asm_output_variant_cc): Update for VLS calling convention.
It looks like this is still tripping failures in CI.
I think you and Robin have agreed on this going forward, so IMHO you
just need to address the CI issues.
jeff