OSDN Git Service

2012-01-30 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / ldist-1.c
1 /* { dg-do compile } */ 
2 /* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-all" } */
3
4 void foo (int * __restrict__ ia,
5           int * __restrict__ ib,
6           int * __restrict__ oxa,
7           int * __restrict__ oxb,
8           int * __restrict__ oya,
9           int * __restrict__ oyb)
10 {
11   int i;
12   long int mya[52];
13   long int myb[52];
14
15   for (i=0; i < 52; i++)
16     {
17       mya[i] = ia[i] * oxa[i] + ib[i] * oxb[i];
18       myb[i] = -ia[i] * oxb[i] + ib[i] * oxa[i];
19       oya[i] = mya[i] >> 10;
20       oyb[i] = myb[i] >> 10;
21     }
22
23   /* This loop was distributed, but it is not anymore due to the cost
24      model changes: the result of a distribution would look like this:
25
26      |  for (i=0; i < 52; i++)
27      |    oya[i] = ia[i] * oxa[i] + ib[i] * oxb[i] >> 10;
28      |
29      |  for (i=0; i < 52; i++)
30      |    oyb[i] = -ia[i] * oxb[i] + ib[i] * oxa[i] >> 10;
31
32      and in this the array IA is read in both tasks.  For maximizing
33      the cache reuse, ldist does not distributes this loop anymore.
34   */
35 }
36
37 /* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */
38 /* { dg-final { cleanup-tree-dump "ldist" } } */