This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unroll fixes


	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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]