annotate gcc/testsuite/gcc.dg/tree-ssa/ldist-6.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-all" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 int loop1 (int k)
kono
parents:
diff changeset
5 {
kono
parents:
diff changeset
6 unsigned int i;
kono
parents:
diff changeset
7 int a[1000], b[1000], c[1000], d[1000];
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 for (i = 2; i < (1000-1); i ++) {
kono
parents:
diff changeset
10 a[i] = k * i; /* S1 */
kono
parents:
diff changeset
11 b[i] = a[i-2] + k; /* S2 */
kono
parents:
diff changeset
12 c[i] = b[i-1] + a[i+1]; /* S3 */
kono
parents:
diff changeset
13 d[i] = c[i-1] + k + i; /* S4 */
kono
parents:
diff changeset
14 }
kono
parents:
diff changeset
15 /* Dependences:
kono
parents:
diff changeset
16 S1->S2 (flow, level 1)
kono
parents:
diff changeset
17 S2->S3 (flow, level 1)
kono
parents:
diff changeset
18 S3->S1 (anti, level 1)
kono
parents:
diff changeset
19 S3->S4 (flow, level 1)
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 There are two partitions: {S1, S2, S3} and {S4}.
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 {S1, S2, S3} have to be in the same partition because:
kono
parents:
diff changeset
24 - S1 (i) has to be executed before S2 (i+2), as S1 produces a[i] that is then consumed 2 iterations later by S2.
kono
parents:
diff changeset
25 - S2 (i) has to be executed before S3 (i+1), as S2 produces b[i] that is then consumed one iteration later by S3,
kono
parents:
diff changeset
26 - S3 (i) has to be executed before S1 (i+1), as a[i+1] has to execute before the update to a[i],
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 {S4} is the consumer partition: it consumes the values from array "c" produced in S3.
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 The cost model should fuse all the tasks together as the cost of
kono
parents:
diff changeset
31 fetching data from caches is too high.
kono
parents:
diff changeset
32 */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 return a[1000-2] + b[1000-1] + c[1000-2] + d[1000-2];
kono
parents:
diff changeset
35 }
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 /* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" { xfail *-*-* } } } */