Skip to content

Commit 2f4fdd2

Browse files
committed
Function attribute for standard vector calling convention variant: riscv_vector_cc
Standard vector calling convention variant will only enabled when function has vector argument or returing value by default, however user may also want to invoke function without that during a vectorized loop at some situation, but it will cause a huge performance penalty due to vector register store/restore. So user can declare function with this riscv_vector_cc attribute like below, that could enforce function will use standard vector calling convention variant. ```c void foo() __attribute__((riscv_vector_cc)); ```
1 parent 84f4288 commit 2f4fdd2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

riscv-c-api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ __attribute__((target("arch=+v"))) int foo(void) { return 0; }
318318
__attribute__((target("arch=+zbb"))) int foo(void) { return 1; }
319319
```
320320
321+
### `__attribute__((riscv_vector_cc))`
322+
323+
Functions declared with this attribute will use to the standard vector calling
324+
convention variant as defined in the RISC-V psABI, even if the function has
325+
vector arguments or returing value.
326+
321327
## Intrinsic Functions
322328
323329
Intrinsic functions (or intrinsics or built-ins) are expanded into instruction sequences by compilers.

0 commit comments

Comments
 (0)