| 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 t = *c; |
| 10 |
for (int i = 0; i < 64; ++i) |
| 11 |
{ |
| 12 |
b[i] = a[i] - t; |
| 13 |
t = a[i]; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
int a[64]; |
| 18 |
short b[64]; |
| 19 |
|
| 20 |
int |
| 21 |
main () |
| 22 |
{ |
| 23 |
check_vect (); |
| 24 |
for (int i = 0; i < 64; ++i) |
| 25 |
{ |
| 26 |
a[i] = i; |
| 27 |
__asm__ volatile ("" ::: "memory"); |
| 28 |
} |
| 29 |
int c = 7; |
| 30 |
foo (a, b, &c); |
| 31 |
#pragma GCC novector |
| 32 |
for (int i = 1; i < 64; ++i) |
| 33 |
if (b[i] != a[i] - a[i-1]) |
| 34 |
abort (); |
| 35 |
if (b[0] != -7) |
| 36 |
abort (); |
| 37 |
return 0; |
| 38 |
} |
| 39 |
|
| 40 |
/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ |