This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unroll fixes
- To: Bernd Schmidt <bernds at redhat dot com>
- Subject: Re: Loop unroll fixes
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Fri, 14 Sep 2001 16:21:42 -0400
- cc: gcc-patches at gcc dot gnu dot org
Okay, let's go through the pieces of the patch one at a time.
Maybe we simply should have asked Zoltan to break up the patches into
independent pieces.
The following has nothing to do with unrolling. A do-while loop
with != condition is generated wrong.
extern int m[];
int i = c;
do {
m[i] = 0;
} while (++i != c);
performs one, fixed iteration on PowerPC, never comparing i and c. The
reality is GCC cannot determine when this loop will terminate. GCC
applies the "bogus iteration count" rule to set the iteration count to
one, which does not apply to this type of test.
David
Index: doloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doloop.c,v
retrieving revision 1.3.4.1
diff -u -r1.3.4.1 doloop.c
--- doloop.c 2001/05/12 20:32:26 1.3.4.1
+++ doloop.c 2001/07/16 21:09:42
@@ -661,7 +634,7 @@
not executed before the start of the loop. We need to determine
if the loop will terminate after the first pass and to limit the
iteration count to one if necessary. */
- if (! loop->vtop)
+ if (! loop->vtop && comparison_code != NE)
{
rtx label;