From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D2052B7094 for ; Tue, 30 Jun 2009 07:40:12 +1000 (EST) Received: from smtp-out.google.com (smtp-out.google.com [216.239.45.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4D070DDD0B for ; Tue, 30 Jun 2009 07:40:12 +1000 (EST) Received: from zps38.corp.google.com (zps38.corp.google.com [172.25.146.38]) by smtp-out.google.com with ESMTP id n5TLTglR000710 for ; Mon, 29 Jun 2009 14:29:42 -0700 Received: from pxi7 (pxi7.prod.google.com [10.243.27.7]) by zps38.corp.google.com with ESMTP id n5TLTe3r020660 for ; Mon, 29 Jun 2009 14:29:40 -0700 Received: by pxi7 with SMTP id 7so841486pxi.12 for ; Mon, 29 Jun 2009 14:29:40 -0700 (PDT) To: kernel mailz Subject: Re: Inline Assembly queries References: From: Ian Lance Taylor Date: Mon, 29 Jun 2009 14:29:38 -0700 In-Reply-To: (kernel mailz's message of "Mon\, 29 Jun 2009 21\:19\:57 +0530") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: gcc-help@gcc.gnu.org, linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , kernel mailz writes: > I tried a small example > > int *p = 0x1000; > int a = *p; > asm("sync":::"memory"); > a = *p; > > and > > volatile int *p = 0x1000; > int a = *p; > asm("sync"); > a = *p > > Got the same assembly. > Which is right. > > So does it mean, if proper use of volatile is done, there is no need > of "memory" ? You have to consider the effects of inlining, which may bring in other memory loads and stores through non-volatile pointers. Ian