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