efriedma added inline comments.
================
Comment at: lib/CodeGen/CGBuiltin.cpp:233
+static Value *EmitAtomicCmpXchgValue(CodeGenFunction &CGF, const CallExpr *E,
+ AtomicOrdering SuccessOrdering = AtomicOrdering::SequentiallyConsistent) {
----------------
Please rename this function; it's very confusing to have both
EmitAtomicCmpXchgValue and MakeAtomicCmpXchgValue which do almost the same
thing, but expect the arguments in the opposite order.
================
Comment at: lib/CodeGen/CGBuiltin.cpp:259-262
+ // For Release ordering, the failure ordering should be Monotonic.
+ auto FailureOrdering = SuccessOrdering == AtomicOrdering::Release ?
+ AtomicOrdering::Monotonic :
+ SuccessOrdering;
----------------
rnk wrote:
> I don't know enough about the memory model to really say if this is right, so
> I'll pass the buck to @efriedma.
This is equivalent to what you'd get for the C++ `a.compare_exchange_strong(x,
y, memory_order::release)`, which should match general intuition about
"release" operations. (There are only three possible failure orderings:
seq_cst, acquire, and monotonic.)
Repository:
rC Clang
https://reviews.llvm.org/D54062
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits