[Mesa-dev] [PATCH] util: use GCC atomic intrinsics with explicit memory model

Nicolai Hähnle nicolai.haehnle at amd.com
Tue Oct 4 16:12:41 UTC 2016


On 04.10.2016 17:50, Jan Vesely wrote:
> On Tue, 2016-10-04 at 16:14 +0200, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> This is motivated by the fact that p_atomic_read and p_atomic_set may
>> somewhat surprisingly not do the right thing in the old version:
>> while
>> stores and loads are de facto atomic at least on x86,
>
> afaik, this is only true for naturally aligned loads/stores (even for
> x86).

Which is all loads and stores in practice, especially in C code 
(unaligned pointers are undefined behavior IIRC).

Nicolai


More information about the mesa-dev mailing list