[PATCH] include: Don't use the MSVC intrinsic _InterlockedCompareExchange128 on clang in MSVC mode

Martin Storsjö martin at martin.st
Sat Dec 19 15:40:40 CST 2020


Hi Jacek,

On Sat, 19 Dec 2020, Jacek Caban wrote:

> Hi Martin,
>
> On 18.12.2020 23:35, Martin Storsjo wrote:
>> This fixes building in PE mode with Clang in MSVC mode for both x86_64
>> and aarch64.
>
>
> I'd expect x86_64 to be fixed by [1], we could do the same for aarch64.

Ah, I see - that explains it. Yeah I was a bit surprised to see that it 
didn't work as expected, as I presumed that you had tested building in 
MSVC mode.

The actual issue here seems to be that the signature of the intrinsic 
_InterlockedCompareExchange128 is slightly wrong. Clang 11 and older (and 
MSVC itself) doesn't mind, but I was testing with a fresh trunk version of 
clang, where it needs to match better. See https://godbolt.org/z/TWbMs8 
for an example of the difference.

FWIW, I bisected the change in behaviour down to 
https://reviews.llvm.org/D77491.

In that case, the fix is simply to correct the signature of the 
declaration - sending a new patch for that instead.

// Martin




More information about the wine-devel mailing list