lkml.org 
[lkml]   [2002]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] [2.5] asm-generic/atomic.h and changes to arm, parisc, mips, m68k, sh, cris to use it
From
Date
On Mon, 2002-08-12 at 13:16, David Woodhouse wrote:
>
> alan@lxorguk.ukuu.org.uk said:
> > Possibly not - volatile doesnt guarantee the compiler won't do
> > x = 1
> > add *p into x
> > store x into *p
>
> Er, AIUI 'volatile' guarantees that '*p++' will do precisely that. It's a
> load, an add and a store, and the rules about volatile mean that the load
> and the store _must_ be separate.

I noticed that while testing how rmk's code behaved differently than
mine (and corrected in the v2 patch).
Before that, I just assumed that since the CPU must anyway issue a
separate load and store, the compiler would use the faster instruction
(that's why there is a LOCK prefix in the i386 instruction set).

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.051 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site