From: No Author Date: Sun, 9 Mar 2003 15:51:41 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch X-Git-Tag: releases/gcc-3.2.3~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cda7b3793801f645adc4b79e61f2755df9b13301;p=thirdparty%2Fgcc.git This commit was manufactured by cvs2svn to create branch 'gcc-3_2-branch'. From-SVN: r64034 --- diff --git a/gcc/testsuite/gcc.dg/i386-loop-1.c b/gcc/testsuite/gcc.dg/i386-loop-1.c new file mode 100644 index 000000000000..635f012a4777 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-loop-1.c @@ -0,0 +1,105 @@ +/* PR optimization/9888 */ +/* { dg-do run { target i?86-*-* } } */ +/* { dg-options "-mtune=k6 -O3" } */ + +/* Verify that GCC doesn't emit out of range 'loop' instructions. */ + +extern void abort (void); +extern void exit (int); + + +f1 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == -1) + return i; + } + return -1; +} + +f2 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != -1) + return i; + } + return -1; +} + +f3 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == 0) + return i; + } + return -1; +} + +f4 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != 0) + return i; + } + return -1; +} + +f5 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a == 0) + return i; + } + return -1; +} + +f6 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a != 0) + return i; + } + return -1; +} + + +int main() +{ + if (f1 (5L) != 5) + abort (); + if (f2 (1L) != 0) + abort (); + if (f2 (0L) != 1) + abort (); + if (f3 (5L) != 4) + abort (); + if (f4 (1L) != 1) + abort (); + if (f4 (0L) != 0) + abort (); + if (f5 (-5L) != 4) + abort (); + if (f6 (-1L) != 1) + abort (); + if (f6 (0L) != 0) + abort (); + exit (0); +}