[libcxx-commits] [libcxx] [libcxx] P0718R2: Implementation of std::atomic<shared_ptr<T>> and std::atomic<weak_ptr<T>> (PR #194215)

Vladislav Semykin via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 3 13:47:13 PDT 2026


ViNN280801 wrote:

Also, I investigated issue #187503 on Rust it's not working as I understand, but for C++ works properly but only if we compile with `march=x86-64-v2`+ or with `__attribute__((target("cx16")))`, here is the example on x86-64 Clang 22.1.0 (assertions), only on `O0` there is no any `cmpxchg16b` as expected: https://godbolt.org/z/s3bd3Ynjc

I used [GCC doc](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html) for verifying that `-mcx16` is the explicit flag to enable `cmpxchg16b` support, and that `-march=x86-64-v2` implicitly includes it (along with SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT). This confirms that the compiler can generate lock-free 128-bit atomics on x86-64, but only when the target architecture explicitly guarantees the instruction.

https://github.com/llvm/llvm-project/pull/194215


More information about the libcxx-commits mailing list