From e2d8cf77c8df45768a3902a97cd357dcf2a5d719 Mon Sep 17 00:00:00 2001
From: Eli Friedman
Acquire provides a barrier of the sort necessary to acquire a lock to access
- other memory with normal loads and stores. This corresponds to the
- C++0x/C1x memory_order_acquire
. This is a low-level
+ other memory with normal loads and stores. This corresponds to the
+ C++0x/C1x memory_order_acquire
. It should also be used for
+ C++0x/C1x memory_order_consume
. This is a low-level
synchronization primitive. In general, optimizers should treat this like
a nothrow call.
Release is similar to Acquire, but with a barrier of the sort necessary to
- release a lock.This corresponds to the C++0x/C1x
- memory_order_release
.
memory_order_release
. In general, optimizers should treat this
+ like a nothrow call.
AcquireRelease (acq_rel
in IR) provides both an Acquire and a Release barrier.
This corresponds to the C++0x/C1x memory_order_acq_rel
. In general,
@@ -171,8 +173,9 @@ instructions has been clarified in the IR.
cmpxchg
and atomicrmw
are essentially like an
atomic load followed by an atomic store (where the store is conditional for
- cmpxchg
), but no other memory operation operation can happen
- between the load and store.
cmpxchg
), but no other memory operation can happen between
+ the load and store. Note that our cmpxchg does not have quite as many
+ options for making cmpxchg weaker as the C++0x version.
A fence
provides Acquire and/or Release ordering which is not
part of another operation; it is normally used along with Monotonic memory
@@ -203,7 +206,7 @@ instructions has been clarified in the IR.