https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113240
Bug ID: 113240
Summary: Use wrong rule to pass fixed-length(size<=2*XLEN)
vector argument
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: lehua.ding at rivai dot ai
Target Milestone: ---
According to a recent proposal
(https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/416), GCC
incorrectly uses references when passing fixed-length vector arguments with
size less than or equal to 2*VLEN instead of scalar registers for passing.
Reproduced online: https://godbolt.org/z/3ooovcz7c
C Code:
```
#include <stdint.h>
typedef int v4si __attribute__ ((vector_size (16)));
v4si foo (v4si a, v4si b)
{
v4si c = a + b;
return c;
}
```
Asm:
```
foo:
vsetivli zero,4,e32,m1,ta,ma
vle32.v v1,0(a1)
vle32.v v2,0(a2)
vadd.vv v1,v1,v2
vse32.v v1,0(a0)
ret
```