* GCC still keeps empty loops? (was: [patch 4/21] fix ARCH_HAS_PREFETCH)
[not found] ` <Pine.LNX.4.44.0208111203520.9930-100000@home.transmeta.com>
@ 2002-08-11 13:07 ` Jamie Lokier
2002-08-12 15:15 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Jamie Lokier @ 2002-08-11 13:07 UTC (permalink / raw)
To: gcc, Linus Torvalds; +Cc: Andrew Morton, Alan Cox, lkml
Linus Torvalds wrote:
> I thought that special case was removed long ago, because it is untenable
> in C++ etc (where such empty loops happen due to various abstraction
> issues, and not optimizing them away is just silly).
>
> But testing shows that you're right at least for 2.95 and 2.96. Argh
Unbelievably, 3.1 doesn't remove empty loops either.
I think there's a case for a compiler flag, `-fremove-empty-loops'.
Empty loop delays aren't portable acrosss compilers in general. If you
_really_ want an empty loop that must always work with GCC, it's easy
enough to write:
for (i = 0; i < 100000; i++)
__asm__ __volatile__ ("");
-- Jamie
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GCC still keeps empty loops? (was: [patch 4/21] fix ARCH_HAS_PREFETCH)
2002-08-11 13:07 ` GCC still keeps empty loops? (was: [patch 4/21] fix ARCH_HAS_PREFETCH) Jamie Lokier
@ 2002-08-12 15:15 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2002-08-12 15:15 UTC (permalink / raw)
To: Jamie Lokier; +Cc: gcc, Linus Torvalds, Andrew Morton, Alan Cox, lkml
On Sun, Aug 11, 2002 at 09:07:18PM +0100, Jamie Lokier wrote:
> Unbelievably, 3.1 doesn't remove empty loops either.
> I think there's a case for a compiler flag, `-fremove-empty-loops'.
Indeed ... It's sad having to scatter ifdefs over the code just because
gcc lacks this optimization ...
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-12 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <3D56B13A.D3F741D1@zip.com.au>
[not found] ` <Pine.LNX.4.44.0208111203520.9930-100000@home.transmeta.com>
2002-08-11 13:07 ` GCC still keeps empty loops? (was: [patch 4/21] fix ARCH_HAS_PREFETCH) Jamie Lokier
2002-08-12 15:15 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).