]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Ensure vector args and return use function stack to pass [PR110119]
authorLehua Ding <lehua.ding@rivai.ai>
Wed, 14 Jun 2023 11:56:11 +0000 (19:56 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 15 Jun 2023 01:18:30 +0000 (09:18 +0800)
commit0ec3fbb5903ac3ad735b3154e814b46724fe1a27
treed98640bce14e3f5bab6fb582e32a53bf64ef0ff1
parent41738a1b3f333d0283fe911f715194f602d318f6
RISC-V: Ensure vector args and return use function stack to pass [PR110119]

The V2 patch address comments from Juzhe, thanks.

Hi,

The reason for this bug is that in the case where the vector register is set
to a fixed length (with `--param=riscv-autovec-preference=fixed-vlmax` option),
TARGET_PASS_BY_REFERENCE thinks that variables of type vint32m1 can be passed
through two scalar registers, but when GCC calls FUNCTION_VALUE (call function
riscv_get_arg_info inside) it returns NULL_RTX. These two functions are not
unified. The current treatment is to pass all vector arguments and returns
through the function stack, and a new calling convention for vector registers
will be added in the future.

https://github.com/riscv-non-isa/riscv-elf-psabi-doc/
https://github.com/palmer-dabbelt/riscv-elf-psabi-doc/commit/126fa719972ff998a8a239c47d506c7809aea363

Best,
Lehua

gcc/ChangeLog:
PR target/110119
* config/riscv/riscv.cc (riscv_get_arg_info): Return NULL_RTX for vector mode
(riscv_pass_by_reference): Return true for vector mode

gcc/testsuite/ChangeLog:
PR target/110119
* gcc.target/riscv/rvv/base/pr110119-1.c: New test.
* gcc.target/riscv/rvv/base/pr110119-2.c: New test.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-2.c [new file with mode: 0644]