OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [predcom-2.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-do run } */
3
/* { dg-options "-O2 -fpredictive-commoning -fdump-tree-pcom-details" } */
4
 
5
void abort (void);
6
 
7
long int fib[1000];
8
 
9
__attribute__ ((noinline))
10
void count_fib(void)
11
{
12
  int i;
13
 
14
  fib[0] = 0;
15
  fib[1] = 1;
16
  for (i = 2; i < 1000; i++)
17
    fib[i] = (fib[i-1] + fib[i - 2]) & 0xffff;
18
}
19
 
20
int avg[1000];
21
 
22
__attribute__ ((noinline))
23
void count_averages(void)
24
{
25
  int i;
26
 
27
  for (i = 1; i < 999; i++)
28
    avg[i] = ((fib[i - 1] + fib[i] + fib[i + 1]) / 3) & 0xffff;
29
}
30
 
31
int main(void)
32
{
33
  count_fib ();
34
  count_averages ();
35
 
36
  if (fib[19] != 4181 || avg[19] != 4510)
37
    abort ();
38
 
39
  if (fib[999] != 162 || avg[998] != 21953)
40
    abort ();
41
 
42
  return 0;
43
}
44
 
45
/* Verify that both loops were transformed and unrolled.  */
46
/* { dg-final { scan-tree-dump-times "Unrolling 2 times." 2 "pcom"} } */
47
/* { dg-final { cleanup-tree-dump "pcom" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.