Debian Codegraph @

gcc/testsuite/gcc.target/pru/loop-hi-1.c

raw
1 /* Test LOOP recognition - short ints*/
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 short short_12345 = 12345;
12 volatile unsigned short short_0 = 0;
13 volatile unsigned short short_1 = 1;
14
15 unsigned int
16 test_loop_short (unsigned short n)
17 {
18 unsigned short i;
19 volatile unsigned int s = 0;
20
21 for (i = 0; i < n; i++)
22 s++;
23 return s;
24 }
25
26 int
27 main (int argc, char** argv)
28 {
29 if (test_loop_short (short_0) != 0)
30 abort();
31 if (test_loop_short (short_1) != 1)
32 abort();
33 if (test_loop_short (short_12345) != 12345)
34 abort();
35
36 return 0;
37 }
38