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

Alexandre Julliard julliard at winehq.org
Mon Jan 18 05:52:20 CST 2021


"Zebediah Figura (she/her)" <zfigura at codeweavers.com> writes:

> 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.

For other platforms it would be OK to require the atomic builtin, we
only care about old compilers on x86.

It would also be OK to use it as an alternative to inline assembly for
InterlockedExchange, but I don't think it's necessary to duplicate all
the other interlocked functions if there's no significant benefit.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list