mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wind@cocodriloo.com
To: linux-kernel@vger.kernel.org
Subject: [wind@cocodriloo.com: Re: GCC still keeps empty loops?  (was: [patch 4/21] fix ARCH_HAS_PREFETCH)]
Date: Sat, 10 Aug 2002 21:39:11 +0200	[thread overview]
Message-ID: <20020810193911.GB8486@wind.holaquehay.com> (raw)

----- Forwarded message from wind@cocodriloo.com -----

Date: Sat, 10 Aug 2002 20:43:13 +0200
From: wind@cocodriloo.com
To: Jamie Lokier <lk@tantalophile.demon.co.uk>
Subject: Re: GCC still keeps empty loops?  (was: [patch 4/21] fix ARCH_HAS_PREFETCH)
Message-ID: <20020810184313.GA8486@wind.holaquehay.com>
References: <3D56B13A.D3F741D1@zip.com.au> <Pine.LNX.4.44.0208111203520.9930-100000@home.transmeta.com> <20020811210718.B3206@kushida.apsleyroad.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20020811210718.B3206@kushida.apsleyroad.org>
User-Agent: Mutt/1.3.28i
Status: RO

On Sun, Aug 11, 2002 at 09:07:18PM +0100, Jamie Lokier wrote:
> 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__ ("");
> 

Of course this delay-loop code will delay a diff. amount of time
depending on processor speed. Don't we have the bogomips stuff
exactly for this sort of small wait times?

What about using internal time-counters from various processors (think
RTDSC on i586+ and it's equivalent on PowerPC, for a start...)

I can still the shakeout when most code which assumed 7mhz 68000
processors for timming got to run on 14mhz 68020 with caches
on the amiga world... your floppies would change tracks a little
bit too fast :)

-- 
es verano y hace calor, el resto de implicaciones son triviales.

::: Antonio Vargas :::

----- End forwarded message -----

-- 
es verano y hace calor, el resto de implicaciones son triviales.

::: winden/network :::

                 reply	other threads:[~2002-08-12 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020810193911.GB8486@wind.holaquehay.com \
    --to=wind@cocodriloo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®