Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.target / i386 / loop-1.c
blob479c80a2d7ab4e784d5ac8c71a25d75d91e501ab
1 /* PR optimization/9888 */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-require-effective-target ilp32 } */
4 /* { dg-options "-mtune=k6 -O3" } */
6 /* Verify that GCC doesn't emit out of range 'loop' instructions. */
8 extern void abort (void);
9 extern void exit (int);
12 f1 (a)
13 long a;
15 int i;
16 for (i = 0; i < 10; i++)
18 if (--a == -1)
19 return i;
21 return -1;
24 f2 (a)
25 long a;
27 int i;
28 for (i = 0; i < 10; i++)
30 if (--a != -1)
31 return i;
33 return -1;
36 f3 (a)
37 long a;
39 int i;
40 for (i = 0; i < 10; i++)
42 if (--a == 0)
43 return i;
45 return -1;
48 f4 (a)
49 long a;
51 int i;
52 for (i = 0; i < 10; i++)
54 if (--a != 0)
55 return i;
57 return -1;
60 f5 (a)
61 long a;
63 int i;
64 for (i = 0; i < 10; i++)
66 if (++a == 0)
67 return i;
69 return -1;
72 f6 (a)
73 long a;
75 int i;
76 for (i = 0; i < 10; i++)
78 if (++a != 0)
79 return i;
81 return -1;
85 int main()
87 if (f1 (5L) != 5)
88 abort ();
89 if (f2 (1L) != 0)
90 abort ();
91 if (f2 (0L) != 1)
92 abort ();
93 if (f3 (5L) != 4)
94 abort ();
95 if (f4 (1L) != 1)
96 abort ();
97 if (f4 (0L) != 0)
98 abort ();
99 if (f5 (-5L) != 4)
100 abort ();
101 if (f6 (-1L) != 1)
102 abort ();
103 if (f6 (0L) != 0)
104 abort ();
105 exit (0);