2015-08-28 15:33:40 +00:00
|
|
|
void abort (void);
|
|
|
|
|
2012-03-27 23:13:14 +00:00
|
|
|
#define N 500
|
2015-08-28 15:33:40 +00:00
|
|
|
#define M 50
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
int X[2*N], Y[2*N], B[2*N];
|
|
|
|
int A[2*N][2*N], C[2*N][2*N];
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
static void __attribute__((noinline,noclone))
|
|
|
|
init (void)
|
|
|
|
{
|
|
|
|
volatile int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < 2 * N; ++i)
|
|
|
|
{
|
|
|
|
B[i] = 1;
|
|
|
|
X[i] = 1;
|
|
|
|
Y[i] = 1;
|
|
|
|
for (j = 0; j < 2 * N; ++j)
|
|
|
|
{
|
|
|
|
A[i][j] = 1;
|
|
|
|
C[i][j] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __attribute__((noinline,noclone))
|
|
|
|
foo (void)
|
2012-03-27 23:13:14 +00:00
|
|
|
{
|
|
|
|
int i, j, k;
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
for (i = 0; i < M; i++)
|
2012-03-27 23:13:14 +00:00
|
|
|
{
|
|
|
|
X[i] = Y[i] + 10;
|
2015-08-28 15:33:40 +00:00
|
|
|
for (j = 0; j < M; j++)
|
2012-03-27 23:13:14 +00:00
|
|
|
{
|
|
|
|
B[j] = A[j][N];
|
2014-09-21 17:33:12 +00:00
|
|
|
for (k = 0; k < N; k++)
|
2012-03-27 23:13:14 +00:00
|
|
|
{
|
|
|
|
A[j+1][k] = B[j] + C[j][k];
|
|
|
|
}
|
|
|
|
Y[i+j] = A[j+1][N];
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 15:33:40 +00:00
|
|
|
}
|
2012-03-27 23:13:14 +00:00
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
static void __attribute__((noinline,noclone))
|
|
|
|
check (void)
|
|
|
|
{
|
|
|
|
volatile int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < 2 * N; ++i)
|
|
|
|
{
|
|
|
|
int expect_x = i < M ? 11 : 1;
|
|
|
|
|
|
|
|
if (B[i] != 1
|
|
|
|
|| X[i] != expect_x
|
|
|
|
|| Y[i] != 1)
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
for (j = 0; j < 2 * N; ++j)
|
|
|
|
{
|
|
|
|
int expect_a = (0 < i && i <= M && j < N) ? 2 : 1;
|
|
|
|
|
|
|
|
if (A[i][j] != expect_a
|
|
|
|
|| C[i][j] != 1)
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
}
|
2012-03-27 23:13:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2015-08-28 15:33:40 +00:00
|
|
|
init ();
|
|
|
|
foo ();
|
|
|
|
check ();
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that parallel code generation part make the right answer. */
|
|
|
|
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
|
2014-09-21 17:33:12 +00:00
|
|
|
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
|