| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "-fno-tree-scev-cprop" } */ |
| 3 |
|
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
/* Statement that is simple and invariant used outside the loop. |
| 7 |
NOTE: SCEV disabled to ensure the live operation is not removed before |
| 8 |
vectorization. */ |
| 9 |
__attribute__ ((noinline)) int |
| 10 |
liveloop (int start, int n, int *x, int *y) |
| 11 |
{ |
| 12 |
int i = start; |
| 13 |
int j; |
| 14 |
int ret; |
| 15 |
|
| 16 |
for (j = 0; j < n; ++j) |
| 17 |
{ |
| 18 |
i += 1; |
| 19 |
ret = y[0]; |
| 20 |
x[j] = i + ret; |
| 21 |
} |
| 22 |
return ret; |
| 23 |
} |
| 24 |
|
| 25 |
#define MAX 77 |
| 26 |
#define START 37 |
| 27 |
|
| 28 |
int |
| 29 |
main (void) |
| 30 |
{ |
| 31 |
int a[MAX]; |
| 32 |
int b = 99; |
| 33 |
int i; |
| 34 |
|
| 35 |
check_vect (); |
| 36 |
|
| 37 |
int ret = liveloop (START, MAX, a, &b); |
| 38 |
|
| 39 |
if (ret != 99) |
| 40 |
abort (); |
| 41 |
|
| 42 |
#pragma GCC novector |
| 43 |
for (i=0; i<MAX; i++) |
| 44 |
{ |
| 45 |
__asm__ volatile (""); |
| 46 |
if (a[i] != i+START+100) |
| 47 |
abort (); |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 52 |
/* { dg-final { scan-tree-dump-not "vec_stmt_relevant_p: stmt live but not relevant" "vect" } } */ |