Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: no-op delay loops
Date: Fri, 27 Nov 2015 12:17:54 +0100	[thread overview]
Message-ID: <3228673.rOyW85ILiP@wuerfel> (raw)
In-Reply-To: <87si3rbz6p.fsf@rasmusvillemoes.dk>

On Friday 27 November 2015 09:53:50 Rasmus Villemoes wrote:
> 
> It seems that gcc happily compiles
> 
> for (i = 0; i < 1000000000; ++i) ;
> 
> into simply
> 
> i = 1000000000;
> 
> (which is then usually eliminated as a dead store). At least at -O2, and
> when i is not declared volatile. So it would seem that the loops at
> 
> arch/mips/pci/pci-rt2880.c:235
> arch/mips/pmcs-msp71xx/msp_setup.c:80
> arch/mips/sni/reset.c:35
> 
> actually don't do anything. (In the middle one, i is 'register', but
> that doesn't change anything.) Is mips compiled with some special flags
> that would make gcc actually emit code for the above?
> 

I remember that gcc used to not optimize code that looked like a
delay loop such as the above, and my tests show that this was still
the case in gcc-4.0.3, but starting with gcc-4.1 it opimtized away
that loop.

	Arnd

  parent reply	other threads:[~2015-11-27 11:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  8:53 no-op delay loops Rasmus Villemoes
2015-11-27  9:04 ` yalin wang
2015-11-27  9:25   ` Andy Shevchenko
2015-11-27 11:17 ` Arnd Bergmann [this message]
2015-11-30 21:29   ` Rasmus Villemoes
2015-11-30 21:44     ` Arnd Bergmann
2015-12-01  1:25     ` Ralf Baechle
2015-12-01 15:31     ` Richard Henderson
2015-11-27 11:20 ` Ralf Baechle

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=3228673.rOyW85ILiP@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=ralf@linux-mips.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