| 1 |
/* Autopar with IF conditions. */ |
| 2 |
/* { dg-additional-options "-fno-thread-jumps" } */ |
| 3 |
|
| 4 |
void abort(); |
| 5 |
|
| 6 |
#define N 10000 |
| 7 |
#define T 1000 |
| 8 |
|
| 9 |
void foo(void) |
| 10 |
{ |
| 11 |
int i; |
| 12 |
int A[2*N], B[2*N]; |
| 13 |
|
| 14 |
/* Initialize array: carried no dependency. */ |
| 15 |
for (i = 0; i < 2*N; i++) |
| 16 |
B[i] = A[i] = i; |
| 17 |
|
| 18 |
for (i = 0; i < N; i++) |
| 19 |
{ |
| 20 |
if (i < T) |
| 21 |
/* loop i1: carried no dependency. */ |
| 22 |
A[i] = A[i+T]; |
| 23 |
else |
| 24 |
/* loop i2: carried dependency. */ |
| 25 |
A[i] = A[i+T+1]; |
| 26 |
} |
| 27 |
|
| 28 |
/* If it runs a wrong answer, abort. */ |
| 29 |
for (i = 0; i < N; i++) |
| 30 |
{ |
| 31 |
if (i < T) |
| 32 |
{ |
| 33 |
if (A[i] != B[i+T]) |
| 34 |
abort(); |
| 35 |
} |
| 36 |
else |
| 37 |
{ |
| 38 |
if (A[i] != B[i+T+1]) |
| 39 |
abort(); |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
int main(void) |
| 45 |
{ |
| 46 |
foo(); |
| 47 |
return 0; |
| 48 |
} |
| 49 |
|
| 50 |
/* Check that parallel code generation part make the right answer. |
| 51 |
??? XFAILed for i1 because conditional store elimination wrecks |
| 52 |
our dependence representation. */ |
| 53 |
/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" { xfail *-*-* } } } */ |
| 54 |
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ |
| 55 |
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ |
| 56 |
/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ |