summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.graphite/force-parallel-7.c
blob: 2fbe10a4e5c590d732a048025f25f028e2187c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#define N 500

int A[N+5][N+5][N+5];

void abort (void);

int foo (void)
{
  int i, j, k;

  for (i = 0; i < N + 5; i++)
    for (j = 0; j < N + 5; j++)
      for (k = 0; k < N + 5; k++)
	A[i][j][k] = i + j + k;

  /* Loop i: carried no dependency.  */
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      for (k = 0; k < N; k++)
	A[k+1][j+2][i+1] = A[k][j][i+1];

  return A[1][5][2];
}

int main (void)
{
  if (5 != foo ())
    abort ();

  return 0;
}

/* Check that parallel code generation part make the right answer.  */
/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */