Hi folks,
as part of implementing (P3008) in libc++ (#186716), the atomicrmw instruction now supports fminimum, fmaximum, fminimumnum, and fmaximumnum floating-point operations (and specializations for a few backends will follow). To leverage these from libc++ I’ve opened #187139 to add the following builtins to clang:
__atomic_fetch_fminimum__atomic_fetch_fmaximum__atomic_fetch_fminimum_num__atomic_fetch_fmaximum_num- (and their
__atomic_xxx_fetchand_scopedvariants).
These follow the style of the pre-existing __atomic_fetch_min and __atomic_fetch_max builtins, and only differ in the operation names which follow the names of the new operations being introduced (i.e. C++26 std::atomic<float>::fetch_fminimum , C23 fminimum_num, etc.).
@efriedma-quic and @pinskia correctly pointed out in the PR that we should ensure alignment between clang and gcc for these builtins. I’ve asked for feedback/objections in the GCC mailing list (LLVM FP atomic min/max variants alignment) but haven’t received any yet (probably due to the on-going GCC16 release work).
Does anyone have any feedback or any objections to the plan proposed above?
Thanks
Gonzalo
This RFC was accepted in this message.