aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/graphite/scop-22a.c
blob: 00d4b5315aeb8bb8ecb618f311766bef1a85becf (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* { dg-require-effective-target size32plus } */
double u[1782225];

void foo(int N, int *res)
{
  int i, j;
  double a, b;
  double sum = 0.0;

  for (j = 3; j < N; j = j * j)
    {
      sum += a + b;
    }

  /* Next two loops form first SCoP */
  for (i = 0; i < N; i++)
    sum += u[i];

  for (i = 0; i < N; i++)
    {
      a = u[i];
      u[i] = i * i;
      b = u[i];
      sum += a + b;
    }

  for (j = 3; j < N; j = j * j)
    {
      sum += a + b;
    }

  for (j = 3; j < N; j = j * j)
    {
      sum += a + b;
    }

  /* Next two loop-nests form second SCoP */
  for (i = 0; i < N; i++)
    sum += u[i];

  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      {
	a = u[i];
	u[i] = i * i;
	b = u[j];
	sum += a + b;
      }

  *res = sum + N;
}

/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "Loops in SCoP" 2 "graphite"} } */
/* { dg-final { scan-tree-dump "Loops in SCoP: 2, 3" "graphite"} } */
/* { dg-final { scan-tree-dump "Loops in SCoP: 6, 7, 8" "graphite"} } */