| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-require-effective-target vect_perm } */ |
| 3 |
|
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
void __attribute__((noipa)) |
| 7 |
foo (int * __restrict__ a, short * __restrict__ b, int * __restrict__ c) |
| 8 |
{ |
| 9 |
int t1 = *c; |
| 10 |
int t2 = *c; |
| 11 |
for (int i = 0; i < 64; i+=2) |
| 12 |
{ |
| 13 |
b[i] = a[i] - t1; |
| 14 |
t1 = a[i]; |
| 15 |
b[i+1] = a[i+1] - t2; |
| 16 |
t2 = a[i+1]; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
int a[64]; |
| 21 |
short b[64]; |
| 22 |
|
| 23 |
int |
| 24 |
main () |
| 25 |
{ |
| 26 |
check_vect (); |
| 27 |
for (int i = 0; i < 64; ++i) |
| 28 |
{ |
| 29 |
a[i] = i; |
| 30 |
__asm__ volatile ("" ::: "memory"); |
| 31 |
} |
| 32 |
int c = 7; |
| 33 |
foo (a, b, &c); |
| 34 |
#pragma GCC novector |
| 35 |
for (int i = 2; i < 64; i+=2) |
| 36 |
if (b[i] != a[i] - a[i-2] |
| 37 |
|| b[i+1] != a[i+1] - a[i-1]) |
| 38 |
abort (); |
| 39 |
if (b[0] != -7 || b[1] != -6) |
| 40 |
abort (); |
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ |