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/] [loop-25.c] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O1 -fdump-tree-profile" } */
3
 
4
int foo(void);
5
void bla(void);
6
void bar(void);
7
 
8
void test1 (void)
9
{
10
  unsigned i;
11
 
12
  /* Only one loop should be found here.  */
13
  i = 0;
14
  while (1)
15
    {
16
      i++;
17
      if (i == 100)
18
        break;
19
 
20
      if (foo ())
21
        bla ();
22
      else
23
        bar ();
24
    }
25
}
26
 
27
void test2 (void)
28
{
29
  unsigned i, j;
30
 
31
  /* Two loops should be found, in this case.  */
32
  i = j = 0;
33
  while (1)
34
    {
35
      j++;
36
      foo ();
37
      if (j < 100)
38
        continue;
39
 
40
      i++;
41
      j = 0;
42
      if (i == 100)
43
        break;
44
    }
45
}
46
 
47
void test3 (void)
48
{
49
  unsigned i, j, k;
50
 
51
  /* Three loops.  */
52
  i = j = k = 0;
53
  while (1)
54
    {
55
      j++;
56
      foo ();
57
      if (j < 100)
58
        continue;
59
 
60
      j = 0;
61
      k++;
62
      if (k < 100)
63
        continue;
64
 
65
      k = 0;
66
      i++;
67
      if (i == 100)
68
        break;
69
    }
70
}
71
 
72
void test4 (void)
73
{
74
  unsigned i, j, k;
75
 
76
  /* Two loops with a nested subloop.  */
77
  i = j = 0;
78
  while (1)
79
    {
80
      j++;
81
      foo ();
82
      for (k = 0; k < 100; k++)
83
        foo ();
84
 
85
      if (j < 100)
86
        continue;
87
 
88
      i++;
89
      j = 0;
90
      if (i == 100)
91
        break;
92
    }
93
}
94
 
95
 
96
void test5 (void)
97
{
98
  unsigned i, j;
99
 
100
  /* Both subloop and non-subloop back edges.  */
101
  i = j = 0;
102
  while (1)
103
    {
104
      j++;
105
      foo ();
106
      if (j < 100)
107
        continue;
108
      j = 0;
109
 
110
      i++;
111
      if (i == 100)
112
        break;
113
 
114
      if (foo ())
115
        bla ();
116
      else
117
        bar ();
118
    }
119
}
120
 
121
/* { dg-final { scan-tree-dump-times "Disambiguating loop" 5 "profile" } } */
122
/* For the following xfail marks, see PR35629.  */
123
/* { dg-final { scan-tree-dump-times "Found latch edge" 5 "profile" { xfail *-*-* } } } */
124
/* { dg-final { scan-tree-dump-times "Merged latch edges" 2 "profile" { xfail *-*-* } } } */
125
/* { dg-final { scan-tree-dump-times "4 loops found" 2 "profile" { xfail *-*-* } } } */
126
/* { dg-final { scan-tree-dump-times "3 loops found" 2 "profile" { xfail *-*-* } } } */
127
/* { dg-final { scan-tree-dump-times "2 loops found" 1 "profile" { xfail *-*-* } } } */
128
 
129
/* { dg-final { cleanup-tree-dump "profile" } } */

powered by: WebSVN 2.1.0

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