| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-mrvv-vector-bits=scalable" } */ |
| 3 |
|
| 4 |
#include "live-1.c" |
| 5 |
|
| 6 |
#define N 107 |
| 7 |
#define OP 70 |
| 8 |
|
| 9 |
#define TEST_LOOP(TYPE) \ |
| 10 |
{ \ |
| 11 |
TYPE a[N]; \ |
| 12 |
for (int i = 0; i < N; ++i) \ |
| 13 |
{ \ |
| 14 |
a[i] = i * 2 + (i % 3); \ |
| 15 |
asm volatile ("" ::: "memory"); \ |
| 16 |
} \ |
| 17 |
TYPE expected = a[N - 1]; \ |
| 18 |
TYPE res = test_##TYPE (a, N, OP); \ |
| 19 |
if (res != expected) \ |
| 20 |
__builtin_abort (); \ |
| 21 |
for (int i = 0; i < N; ++i) \ |
| 22 |
{ \ |
| 23 |
TYPE old = i * 2 + (i % 3); \ |
| 24 |
if (a[i] != (TYPE) (old * (TYPE) OP)) \ |
| 25 |
__builtin_abort (); \ |
| 26 |
asm volatile ("" ::: "memory"); \ |
| 27 |
} \ |
| 28 |
} |
| 29 |
|
| 30 |
int __attribute__ ((optimize (1))) |
| 31 |
main (void) |
| 32 |
{ |
| 33 |
TEST_ALL (TEST_LOOP); |
| 34 |
return 0; |
| 35 |
} |