]>
Commit | Line | Data |
---|---|---|
99e0e30f SP |
1 | /* Autopar with IF conditions. */ |
2 | ||
3 | void abort(); | |
4 | ||
5 | #define N 10000 | |
6 | #define T 1000 | |
7 | ||
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 | ||
43 | int main(void) | |
44 | { | |
45 | foo(); | |
46 | return 0; | |
47 | } | |
48 | ||
49 | /* Check that parallel code generation part make the right answer. */ | |
50 | /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ | |
51 | /* { dg-final { cleanup-tree-dump "graphite" } } */ | |
52 | /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ | |
53 | /* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ | |
54 | /* { dg-final { cleanup-tree-dump "parloops" } } */ | |
55 | /* { dg-final { cleanup-tree-dump "optimized" } } */ |