ABI for atomic fetch min/max in libatomic (original) (raw)

Hi,

I’m working on implementing support for integer atomic fetch_min and fetch_max operations in GCC’s libatomic that back the C++26 std::atomic<int>::fetch_max and std::atomic<int>::fetch_min operations.

My goal with this query is to reach an agreement on the libatomic (or any other library implementation of the operations) ABI for these calls with the LLVM community.

Unlike other atomic operations, min/max have different semantics for signed vs unsigned types. This means that at one point, we need to have a split in the libcalls we generate to call libatomic.

I propose doing this with the following naming convention:

Unsigned:

Signed:

Similar to Atomic floating point operations and libstdc++, as this is a choice outside the GNU project, I would like to confirm with the LLVM community if this naming convention seems OK.

CCing folks who participated in that thread here: @mmalcomson @efriedma-quic

These names for the new functions in the libatomic ABI sound good to me.

Endill July 29, 2025, 7:43pm 3

Note that a year ago there was a discussion involving all 3 standard library implementations regarding intrinsic naming: P2985R0 A type trait for detecting virtual base classes · Issue #98310 · llvm/llvm-project · GitHub

soumyaa July 30, 2025, 8:16am 4

Great, thanks for taking a look!