| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ |
| 3 |
|
| 4 |
#define N 4 |
| 5 |
struct C { int l, r; }; |
| 6 |
struct C a[N], b[N], c[N]; |
| 7 |
struct C a1[N], b1[N], c1[N]; |
| 8 |
|
| 9 |
void __attribute__((noinline)) |
| 10 |
init_data_vec (struct C * __restrict a, struct C * __restrict b, |
| 11 |
struct C * __restrict c) |
| 12 |
{ |
| 13 |
int i; |
| 14 |
|
| 15 |
for (i = 0; i < N; ++i) |
| 16 |
{ |
| 17 |
a[i].l = N - i; |
| 18 |
a[i].r = i - N; |
| 19 |
|
| 20 |
b[i].l = i - N; |
| 21 |
b[i].r = i + N; |
| 22 |
|
| 23 |
c[i].l = -1 - i; |
| 24 |
c[i].r = 2 * N - 1 - i; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
int |
| 29 |
main () |
| 30 |
{ |
| 31 |
int i; |
| 32 |
|
| 33 |
init_data_vec (a, b, c); |
| 34 |
|
| 35 |
#pragma GCC novector |
| 36 |
for (i = 0; i < N; ++i) |
| 37 |
{ |
| 38 |
a1[i].l = N - i; |
| 39 |
a1[i].r = i - N; |
| 40 |
|
| 41 |
b1[i].l = i - N; |
| 42 |
b1[i].r = i + N; |
| 43 |
|
| 44 |
c1[i].l = -1 - i; |
| 45 |
c1[i].r = 2 * N - 1 - i; |
| 46 |
} |
| 47 |
|
| 48 |
for (i = 0; i < N; i++) |
| 49 |
{ |
| 50 |
if (a[i].l != a1[i].l || a[i].r != a1[i].r) |
| 51 |
__builtin_abort (); |
| 52 |
|
| 53 |
if (b[i].l != b1[i].l || b[i].r != b1[i].r) |
| 54 |
__builtin_abort (); |
| 55 |
|
| 56 |
if (c[i].l != c1[i].l || c[i].r != c1[i].r) |
| 57 |
__builtin_abort (); |
| 58 |
} |
| 59 |
|
| 60 |
return 0; |
| 61 |
} |