atomic_cmpset_64 vs atomic_cas_64
Mateusz Guzik
mjguzik at gmail.com
Fri Oct 4 14:35:48 UTC 2019
On 10/4/19, Andriy Gapon <avg at freebsd.org> wrote:
>
> I see that almost all 64-bit platforms provide atomic_cmpset_64, but
> sparc64
> provides atomic_cas_64 (instead?).
> I think that the meanings of "cas" and "cmpset" are really the same, but I
> am
> not sure if there are any differences in that the functions do.
> Could anyone who knows that stuff (sparc64 assembly) please shed some
> light?
> Thanks!
>
> #define atomic_cas_64(p, e, s) casxa((p), (e), (s), __ASI_ATOMIC)
>
cas returns the found value, while cmpset throws it away.
static __inline int \
atomic_cmpset_ ## name(volatile ptype p, vtype e, vtype s) \
{ \
return (((vtype)atomic_cas((p), (e), (s), sz)) == (e)); \
}
Just use fcmpset instead.
--
Mateusz Guzik <mjguzik gmail.com>
More information about the freebsd-arch
mailing list