mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 04:30:10 +01:00
util/u_atomic: Add implementation of __sync_val_compare_and_swap_8
Needed for 32-bit PowerPC.
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Fixes: a6a38a038b ("util/u_atomic: provide 64bit atomics where
they're missing")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
d075a4089e
commit
1bbe180873
1 changed files with 14 additions and 0 deletions
|
|
@ -60,6 +60,20 @@ __sync_sub_and_fetch_8(uint64_t *ptr, uint64_t val)
|
|||
return r;
|
||||
}
|
||||
|
||||
WEAK uint64_t
|
||||
__sync_val_compare_and_swap_8(uint64_t *ptr, uint64_t oldval, uint64_t newval)
|
||||
{
|
||||
uint64_t r;
|
||||
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
r = *ptr;
|
||||
if (*ptr == oldval)
|
||||
*ptr = newval;
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
WEAK uint64_t
|
||||
__atomic_fetch_add_8(uint64_t *ptr, uint64_t val, int memorder)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue