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