[PATCH 3/7] Remove atomic_bit_set/bit_test_set
Noah Goldstein
goldstein.w.n@gmail.com
Wed Jul 6 19:14:38 GMT 2022
On Wed, Jul 6, 2022 at 12:00 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Noah,
>
> > > - if (atomic_bit_test_set (&pd->cancelhandling, TERMINATED_BIT) == 0)
> > > + if ((atomic_fetch_or_acquire (&pd->cancelhandling, 1 << TERMINATED_BIT)
> > > + & (1 << TERMINATED_BIT)) == 0)
>
> > Can these remain macros that setup the bit_test_set properly but
> > use compiler intrinsics?
>
> The fetch_or above is already written in a way that allows GCC to recognize it
> (it's identical to your do_atomic_or0), so I don't see any issue here. However
> there is a TERMINATED_BITMASK which might make it more readable.
For non-constant shift values it needs to be like atomic_or4/atomic_or5.
Since this needs to be set up in a particular way it seems worth it to
keep it as a macro that will do it properly. Fine with replacing the underlying
atomic op with a compiler intrinsic.
>
> Cheers,
> Wilco
More information about the Libc-alpha
mailing list