[libcxx-commits] [libcxx] [libc++] Implement P0493R5: Atomic minimum/maximum (PR #180333)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 8 07:07:46 PST 2026
huixie90 wrote:
> > I think clang does tried to create the builtin that looks like gcc one , but gcc does not actually have it.
> > ```
> > // GCC does not support these, they are a Clang extension.
> > def AtomicFetchMax : AtomicBuiltin {
> > let Spellings = ["__atomic_fetch_max"];
> > let Attributes = [CustomTypeChecking];
> > let Prototype = "void(...)";
> > }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Given about, in the `atomic_ref` case, I wonder if we should test if the builtin exists, if so, use it , otherwise fallback to the CAS loop?
>
> Indeed, using the builtin will simplify the implementation for clang. Done.
Thanks a lot for the quick respond! Ville (Thanks a lot Ville!) has pointed out that libstdc++ has landed this patch
https://github.com/gcc-mirror/gcc/commit/68a1218c189cce1eea2f3b035848984aa2ee8a5b
and in-progress gcc patch uses the name that clangs extends
https://gcc.gnu.org/pipermail/gcc-patches/2026-February/707563.html
In this case, I would suggest to use the builtin if it exists in gcc.h
https://github.com/llvm/llvm-project/pull/180333
More information about the libcxx-commits
mailing list