[llvm-dev] atomic ops are optimized with incorrect semantics .

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 11 03:08:08 PST 2020


On 11/02/2020 09:43, Umesh Kalappa via llvm-dev wrote:
> may be in x86 ,you are right mov is atomic, but if we need to sync the 
> operation with the previous insn's then just having atomic doesn't help 
> right?

You need a sync to establish a happens-before edge.  This is a 
relaxed-consistency store and so does not establish any happens-before 
relationship.

Atomic just means indivisible: any other thread is guaranteed that it 
will see not see any partial stores, it will see either the value from 
before this store or the value after.  Because this does not establish 
any happens-before edges, the notion of 'before' is somewhat fuzzy here 
and there does not have to be any sequential ordering of threads that 
gives the same observations as their interleaved run.

David


More information about the llvm-dev mailing list