This is the mail archive of the gcc@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 unrolling


> 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).


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