[libcxx-commits] [libcxx] [libcxx] p3008 atomic fp min/max (PR #186716)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 21 08:21:05 PDT 2026
================
@@ -372,6 +378,44 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
return __rmw_op(std::forward<_This>(__self), __operand, __m, __minus, __builtin_op);
}
+ template <class _This>
+ _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_min(_This&& __self, _Tp __operand, memory_order __m) {
+ auto __op = [](_Tp __a, _Tp __b) { return std::__math::fmin(__a, __b); };
----------------
gonzalobg wrote:
They generate incorrect results in some compilers like clang (they've been very buggy for a long time), and cleanly detecting those compilers and selecting the fallback vs the builtins is complicated enough to deserve its own isolated separate PR.
https://github.com/llvm/llvm-project/pull/186716
More information about the libcxx-commits
mailing list