| 1 |
#include "tree-vect.h" |
| 2 |
|
| 3 |
#define N (VECTOR_BITS / 32) |
| 4 |
#define MAX_COUNT 4 |
| 5 |
|
| 6 |
void __attribute__ ((noipa)) |
| 7 |
run (int *restrict a, int *restrict b, int count) |
| 8 |
{ |
| 9 |
for (int i = 0; i < count * N; ++i) |
| 10 |
{ |
| 11 |
a[i * 2] = b[i * 2] + count; |
| 12 |
a[i * 2 + 1] = count; |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
void __attribute__ ((noipa)) |
| 17 |
check (int *restrict a, int count) |
| 18 |
{ |
| 19 |
#pragma GCC novector |
| 20 |
for (int i = 0; i < count * N; ++i) |
| 21 |
if (a[i * 2] != i * 41 + count || a[i * 2 + 1] != count) |
| 22 |
__builtin_abort (); |
| 23 |
if (a[count * 2 * N] != 999) |
| 24 |
__builtin_abort (); |
| 25 |
} |
| 26 |
|
| 27 |
int a[N * MAX_COUNT * 2 + 1], b[N * MAX_COUNT * 2]; |
| 28 |
|
| 29 |
int |
| 30 |
main (void) |
| 31 |
{ |
| 32 |
check_vect (); |
| 33 |
|
| 34 |
for (int i = 0; i < N * MAX_COUNT; ++i) |
| 35 |
{ |
| 36 |
b[i * 2] = i * 41; |
| 37 |
asm volatile ("" ::: "memory"); |
| 38 |
} |
| 39 |
|
| 40 |
for (int i = 0; i <= MAX_COUNT; ++i) |
| 41 |
{ |
| 42 |
a[i * 2 * N] = 999; |
| 43 |
run (a, b, i); |
| 44 |
check (a, i); |
| 45 |
} |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |
| 49 |
|
| 50 |
/* { dg-final { scan-tree-dump-times {LOOP VECTORIZED} 1 "vect" { target { { vect_int && vect_perm } && vect_element_align } } } } */ |