mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
This patch extends libstdc++ to implement C++26's atomic fetch min/max operations. The __atomic_fetch_minmaxable concept checks if __atomic_fetch_min and __atomic_fetch_max builtins are implemented by the compiler. If not, fall back to a CAS loop. This patch was bootstrapped and regtested on aarch64-linux-gnu and x86_64-linux-gnu, no regression. Signed-off-by: Soumya AR <soumyaa@nvidia.com> libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Add fetch_min and fetch_max memberfunctions. * include/bits/version.def: Add __cpp_lib_atomic_min_max feature test macro. * include/bits/version.h (defined): Regenerate. * include/std/atomic: Extend for fetch_min/max non-member functions. * src/c++23/std.cc.in: Export atomic_fetch_min, atomic_fetch_max, atomic_fetch_min_explicit, atomic_fetch_max_explicit. * testsuite/29_atomics/atomic_integral/nonmembers_fetch_minmax.cc: New test. * testsuite/29_atomics/atomic_ref/integral_fetch_minmax.cc: New test.
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.