<div dir="ltr"><div>A question has come up on how to interpret the wording of LLVM's documentation regarding the possible memory ordering for success and failure of atomic compare_exchange operations.</div><div><br></div><div>From the LLVM reference:</div><div><br></div><div>"The success and failure <a href="https://llvm.org/docs/LangRef.html#ordering" rel="nofollow noopener">ordering</a> arguments specify how this <code>cmpxchg</code> synchronizes with other atomic operations. Both ordering parameters must be at least <code>monotonic</code> , the ordering constraint on failure must be no stronger than that on success, and the failure ordering cannot be either <code>release</code> or <code>acq_rel</code> ."</div><div><br></div><div>The way this operation is implemented inĀ  the standard library of the Rust programming language, the combination of release (success) and acquire (failure) is not permitted and will fail at runtime, the prevailing opinion being, that a failing CAS with release/acquire ordering is actually relaxed on the store part and hence acquire ordering for the failure case would be stronger.</div><div><br></div><div>However, I don't believe that this a correct reading of the specification and that neither acquire nor release should be considered stronger or weaker than the other and that hence that combination should be permitted. <br></div><div><br></div><div>I had hoped to get get some clarification on this issue here.<br></div><div><br></div><div><br></div><div><br></div></div>