This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling
- To: steve at icarus dot icarus dot com (Stephen Williams)
- Subject: Re: Loop unrolling
- From: Tim Hollebeek <tim at wagner dot princeton dot edu>
- Date: Mon, 1 Jun 1998 18:26:41 -0400 (EDT)
- Cc: pfeifer at dbai dot tuwien dot ac dot at, egcs at cygnus dot com
Stephen Williams writes ...
>
>
> pfeifer@dbai.tuwien.ac.at said:
> > As a matter of fact, is there still any strong reason not to delete
> > empty loops in general?
>
> As a matter of fact, there is. Us embedded programmers are sometimes
> compelled to write timing loops. I guess we should (and I usually do)
> make those loops non-empty, but still ....
Is there any compelling reason why this shouldn't be an asm() block,
since otherwise optimizer changes could change the length of the loop?
For example, an "intelligent" loop optimizer could add nop's to a loop
to improve alignment, cache, or scheduling constraints.
It seems to me that such a timing loop relies on the loop generating the
same code, and as such is better as an explicit asm statement. Linux,
for example, gets this right.
So there really is no need for an empty loop in such a case.
---------------------------------------------------------------------------
Tim Hollebeek | "Everything above is a true
email: tim@wfn-shop.princeton.edu | statement, for sufficiently
URL: http://wfn-shop.princeton.edu/~tim | false values of true."