[PATCH] x86: Use more __sync builtins in atomic-machine.h
Collin Funk
collin.funk1@gmail.com
Mon Sep 1 17:38:45 GMT 2025
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:
> There are the old-style atomic macros and we are moving the code to the
> one modeled after C11 atomic (USE_ATOMIC_COMPILER_BUILTINS).
>
> The atomic_exchange_acq is only used to implement atomic_exchange_rel,
> but neither is used anywhere (besides misc/tst-atomic.c). Same for atomic_add,
> atomic_add_negative, atomic_add_zero, atomic_decrement_and_test, atomic_and,
> and atomic_or.
>
> The only macro that is actually used is atomic_full_barrier() at only one
> place for Linux (nptl/pthread_mutex_setprioceiling.c, Hurd use in other
> places) and maybe we can use a different atomic operation here (a release
> store, as pthread_mutex_lock).
>
> So maybe it would be better to start remove these and other macros for the
> architectures that define USE_ATOMIC_COMPILER_BUILTINS (as x86) and reevaluate
> if we can start to use USE_ATOMIC_COMPILER_BUILTINS on the missing one.
+1 for avoiding __sync. Gnulib, for example, uses them in order to
support older compiler versions. But since glibc requires GCC 12.1 I
think it is best to just use the newer ones.
Collin
More information about the Libc-alpha
mailing list