This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is "memory" clobber required for all inline asm which does atomic operation???


On Jun 11, 2004, "Ashok.A" <ashok_kumar_ak@yahoo.com> wrote:

> * Should we use "memory" clobber in *every* inline asm
>   which does atomic operation?

You should use "memory" clobber if the asm statement modifies memory
that is not otherwise passed as an output operand to the asm
statement.  That's about it.  It doesn't matter if you're doing atomic
operations or not.

It might be a good idea to mark atomic operations implemented with asm
statements as volatile, though, such that GCC doesn't schedule them
around the very bits they're meant to protect.

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]