[PATCH 5/5] x86: Define atomic_compare_and_exchange_{val, bool}_acq using __atomic_compare_exchange_n
Uros Bizjak
ubizjak@gmail.com
Wed Sep 10 19:44:22 GMT 2025
On Wed, Sep 10, 2025 at 8:01 PM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 10/09/25 13:59, Wilco Dijkstra wrote:
> > Hi Uros,
> >
> >>> However, it looks that after [1] gets committed, these macros should
> >>> be removed from target headers.
> >>>
> >>> I will wait a couple of days for dust to settle, and I'll respin the series.
> >>>
> >>> [1] https://sourceware.org/pipermail/libc-alpha/2025-September/169942.html
> >>
> >> I think it should be fine, I working on top of the Wilco patches to cleanup
> >> even more internal atomic builtins and I think both patchsets do not
> >> interfere with each other.
> >
> > My patch series has gone in, so these definitions are now redundant:
> >
> > #define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
> >
> > #define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
> >
> > #define atomic_exchange_acq(mem, newvalue) \
> >
> > #define catomic_exchange_and_add(mem, value) \
>
> Yeap, I am preparing a patchset to cleanup atomic.h/atomic-machine.h even more.
OK, I'll wait for the generic part to settle down before proposing a
trivial removal patch.
BTW: Do you also plan to change generic definition of
atomic_full_barrier() and friends to:
#ifndef atomic_full_barrier
# define atomic_full_barrier() __atomic_thread_fence (__ATOMIC_SEQ_CST)
#endif
and similar for:
#define atomic_read_barrier() __atomic_thread_fence (__ATOMIC_ACQUIRE)
#define atomic_write_barrier() __atomic_thread_fence (__ATOMIC_RELEASE)
This works for x86 and allows some more instruction scheduling to the
compiler when __atomic_thread_fence() is used in the latter two
instead of
__asm ("" ::: "memory")
Uros.
More information about the Libc-alpha
mailing list