1 /* Test LOOP recognition */
2
3 /* { dg-do run } */
4 /* { dg-options "-O1 -mloop" } */
5
6 /* -O1 in the options is significant. Without it do-loop will not be
7 run. */
8
9 extern void abort (void);
10
11 volatile unsigned int int_12345 = 12345;
12 volatile unsigned int int_0 = 0;
13 volatile unsigned int int_1 = 1;
14
15 unsigned int
16 test_loop (unsigned int n)
17 {
18 unsigned int i;
19 volatile unsigned int s = 0;
20
21 if (n >= 0x10000) return 0;
22
23 for (i = 0; i < n; i++)
24 s++;
25 return s;
26 }
27
28
29 int
30 main (int argc, char** argv)
31 {
32 if (test_loop (int_0) != 0)
33 abort();
34 if (test_loop (int_1) != 1)
35 abort();
36 if (test_loop (int_12345) != 12345)
37 abort();
38
39 return 0;
40 }
41