[PATCH v2 3/5] include: Prefer GCC __atomic builtins if possible.

Zebediah Figura (she/her) zfigura at codeweavers.com
Fri Jan 15 10:46:11 CST 2021


On 1/15/21 10:34 AM, Alexandre Julliard wrote:
> Zebediah Figura <z.figura12 at gmail.com> writes:
> 
>> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
>> ---
>> v2: avoid 16-bit __atomic_compare_exchange_n()
>>
>>  include/winnt.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 53 insertions(+)
> 
> How are these better than the __sync ones in practice?
> 

I think the only real benefit is atomic exchange; it allows the compiler
to maybe yield better code for x86 than our inline assembly (although it
surely would never make a difference in practice), and presumably better
code for other platforms than a compare-and-swap loop.

The actual practical benefit is probably negligible, but I figured we
might as well use a proper compiler intrinsic for atomic swap if there
was one available.



More information about the wine-devel mailing list