This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling
- To: mrs at wrs dot com (Mike Stump)
- Subject: Re: Loop unrolling
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Tue, 16 Jun 1998 11:11:30 +0100 (BST)
- Cc: vonbrand at sleipnir dot valparaiso dot cl, amylaar at cygnus dot co dot uk, branko dot cibej at hermes dot si, egcs at cygnus dot com, law at cygnus dot com, pfeifer at dbai dot tuwien dot ac dot at
> What you mean to say is that people that expect gcc to correctly
> compile old style timing loops are wrong for expecting it to work, and
> that you think we should break their existing code, renig on our
> documented promise to not break their code, and remove this documented
> GNU extension from gcc, and break their code.
When I first read that part of the documentation - I was still a mere
gcc user then - I understood it to be an explanation, not to say an
apology, why empty loops are not optimized out.
The reasoning why removing empty loops is not worth the bother no
longer holds. Hence we should remove them.
We should probably avoid loops with volatile loop variables for the
time being, but we should not condone this as a valid way to write
a timing loop. If you must write a timing loop, make it non-empty
in such a way that the contents cannot be optimized out
(e.g. an asm volatile that uses the loop counter in a register).