loop optimization

Alexandre Oliva aoliva@redhat.com
Wed Aug 2 16:24:00 GMT 2000


On Aug  1, 2000, Mark Lundeberg <aa026@pgfn.bc.ca> wrote:

> while(count--)

> My question is, will gcc see this as a target for optomization as it would
> for "for(i=0;i<count;i++)"?

I think so.  In fact, it will even use decrement-and-branch
instructions where available, without having to reverse the loop as it
sometimes does in the `for' case.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-help mailing list