From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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> Subject: Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r Date: Thu, 23 Aug 2007 21:05:40 +0100 Message-ID: <14578.1187899540@redhat.com> Sender: linux-arch-owner@vger.kernel.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 List-ID: 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