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 E7C6BB70B5 for ; Tue, 30 Jun 2009 19:52:50 +1000 (EST) Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id D4BC4DDD04 for ; Tue, 30 Jun 2009 19:52:50 +1000 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <19017.57453.426119.659907@cargo.ozlabs.ibm.com> Date: Tue, 30 Jun 2009 19:52:45 +1000 From: Paul Mackerras To: kernel mailz Subject: Re: Inline Assembly queries In-Reply-To: References: Cc: gcc-help@gcc.gnu.org, linuxppc-dev@ozlabs.org, Ian Lance Taylor List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , kernel mailz writes: > Consider atomic_add and atomic_add_return in kernel code. > I am not able to figure out why "memory" is added in latter The "memory" indicates that gcc should not reorder accesses to memory from one side of the asm to the other. The reason for putting it on the atomic ops that return a value is that they are sometimes used to implement locks or other synchronization primitives. Paul.