Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod From: yalin wang Newsgroups: linux.kernel Subject: Re: no-op delay loops Date: Fri, 27 Nov 2015 10:10:03 +0100 Message-ID: References: X-Original-To: Rasmus Villemoes Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=gDqqssUX0S8XFo9gMt6Hc6nJWKD2/2fTRutS/kFw+Zs=; b=W+K8Ah5XWDPyw0P8BzZGBVXyKp38Kkuw7LBDRCBt4e+hOx0QRXQPjE9DGBhhixwy3J 8p2n3pI/d731kVL6DkXTm/4OrWc3VriRxzX5tgvG/FjYKjx2RXMRkQnl8ar6+cCD7YQO 9RbE8yADwX5XLJrxjxAm9wj/Kq+ixbePMnNHRUel08NBA4hJt56Z9sYwod6PLorYwiDq fxX7lwUIQ1hRZ+oTmU/omWQB9gg1a1/grZWT4UGp/pyR0Tsg7zRP1PvrjK7/u1FbPdTO rR/x5KzFobQbYcaFtPgoI/EV9bfg5SEs3WLlx3T4EqcqR7wix0CJ8itX+4OqlDZUkn6w iGQw== X-Received: by 10.67.6.1 with SMTP id cq1mr55333567pad.78.1448615090226; Fri, 27 Nov 2015 01:04:50 -0800 (PST) Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Content-Transfer-Encoding: 8BIT X-Mailer: Apple Mail (2.3094) Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 34 Organization: linux.* mail to news gateway X-Original-Cc: Ralf Baechle , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org X-Original-Date: Fri, 27 Nov 2015 17:04:43 +0800 X-Original-Message-ID: <7B39C9C2-1093-49CE-9A1E-5059A57C298A@gmail.com> X-Original-References: <87si3rbz6p.fsf@rasmusvillemoes.dk> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1278659 > On Nov 27, 2015, at 16:53, Rasmus Villemoes wrote: > > Hi, > > 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? > you can try to declare i as volatile int i; may gcc will not optimize it . Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/