Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765049AbXHWUGU (ORCPT ); Thu, 23 Aug 2007 16:06:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756302AbXHWUGF (ORCPT ); Thu, 23 Aug 2007 16:06:05 -0400 Received: from mx1.redhat.com ([66.187.233.31]:37955 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755568AbXHWUGD (ORCPT ); Thu, 23 Aug 2007 16:06:03 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <46C03885.7000109@redhat.com> <20070813112452.GK24018@shell.boston.redhat.com> <46CC42EF.3030602@redhat.com> <8fc86c23579e12b012891d6e69b1b107@kernel.crashing.org> To: Segher Boessenkool Cc: dhowells@redhat.com, Linus Torvalds , Hirokazu Takata , "Robert P. J. Day" , paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, "Luck, Tony" , akpm@linux-foundation.org, linux-arch@vger.kernel.org, Chris Snook , Chris Friesen Subject: Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r X-Mailer: MH-E 8.0.3; nmh 1.2-20070115cvs; GNU Emacs 22.1.50 Date: Thu, 23 Aug 2007 21:05:40 +0100 Message-ID: <14578.1187899540@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 751 Lines: 23 Segher Boessenkool wrote: > This simply isn't true. The compiler *can* combine asm stuff: > > > typedef struct { int counter; } atomic_t; > > static inline __attribute__((pure)) int atomic_read(const atomic_t *v) > { > int x; > asm("ld %0,@%1" : "=r"(x) : "r"(&v->counter), "m"(v->counter)); > return x; > } That's not precisely combining asm stuff. The compiler is ditching a whole function because you've told it it can cache the result. David - 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/