https://eel.is/c++draft/atomics.types.operations#23 says: ... the value of failure is order except that a value of memory_order::acq_rel shall be replaced by the value memory_order::acquire and a value of memory_order::release shall be replaced by the value memory_order::relaxed.
This failure mapping is only handled for _LIBCPP_HAS_GCC_ATOMIC_IMP. We are seeing bad code generation for compare_exchange_strong(cmp, 1, std::memory_order_acq_rel) when using libc++ in place of libstdc++: https://godbolt.org/z/v3onrrq4G.
This was caught by tsan tests after D99434, [TSAN] Honor failure memory orders in AtomicCAS, but appears to be an issue in non-tsan code.