| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=m2" } */ |
| 3 |
/* { dg-require-effective-target riscv_v } */ |
| 4 |
|
| 5 |
__attribute__((noinline, noclone)) static int |
| 6 |
bar (const short *a, int len) |
| 7 |
{ |
| 8 |
int x; |
| 9 |
int x1 = 0; |
| 10 |
|
| 11 |
for (x = 0; x < len; x++) |
| 12 |
x1 += x * a[x]; |
| 13 |
return x1; |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__((noinline, noclone)) void |
| 17 |
foo (void) |
| 18 |
{ |
| 19 |
short stuff[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
| 20 |
if (bar (stuff, 9) != 36) |
| 21 |
__builtin_abort (); |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
foo (); |
| 28 |
return 0; |
| 29 |
} |