[libcxx-commits] [libcxx] [libcxx] atomic min/max (PR #186694)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 17 05:41:43 PDT 2026
================
@@ -259,6 +261,48 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o
std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
}
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _Tp
+__cxx_atomic_fetch_min(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
+ _Tp __old = __cxx_atomic_load(__a, memory_order_relaxed);
+ _Tp __new;
+ do {
+ __new = __old < __val ? __old : __val;
+ } while (!__cxx_atomic_compare_exchange_weak(__a, &__old, __new, __order, memory_order_relaxed));
----------------
gonzalobg wrote:
There were many more of these missing, so have addressed these in https://github.com/llvm/llvm-project/pull/186694/commits/0adc9b3e864f4cba65342b184fcff203c46bb637
https://github.com/llvm/llvm-project/pull/186694
More information about the libcxx-commits
mailing list