Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/abi-call-args-2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O1" } */
3
4 #include <stdarg.h>
5 #include "riscv_vector.h"
6
7 int8_t
8 va_callee (int count, ...)
9 {
10 size_t vlmax = __riscv_vsetvlmax_e8m1 ();
11 vint8m1_t sum = __riscv_vmv_v_x_i8m1 (0, vlmax);
12 va_list ap;
13 va_start (ap, count);
14 for (int i = count; i > 0; i--)
15 {
16 vint8m1_t arg = va_arg (ap, vint8m1_t);
17 sum = __riscv_vredsum_vs_i8m1_i8m1 (arg, sum, vlmax);
18 }
19 va_end (ap);
20 return __riscv_vmv_x_s_i8m1_i8 (sum);
21 }
22
23 /* Make sure the variadic arguments is not passed through the vector register.
24 */
25 /* { dg-final { scan-assembler-not {vs[0-9]+r} } } */
26 /* { dg-final { scan-assembler-not {vsm} } } */
27 /* { dg-final { scan-assembler-not {vse[0-9]+} } } */