[cfe-dev] clang-cl and _Interlocked* intrinsics

Ethan Smith via cfe-dev cfe-dev at lists.llvm.org
Tue May 22 16:37:21 PDT 2018


 Hello,

I am working on porting CPython to build with clang-cl on Windows, since I
expect things like labels as values and other optimizations could provide a
significant speedup. I am currently running into a strange issue, and was
directed here from IRC. When I have, for example,

#include <intrin.h>
#include <immintrin.h>

int main() {
    _InterlockedCompareExchange64_HLEAcquire(4L, 5L, 6L);
}

building with cl is fine (minus obvious warnings about long to pointer
conversion). However, if I build with clang-cl, I get "unresolved external
symbol _InterlockedCompareExchange64_HLEAcquire referenced in function
main". When I build this in a Visual Studio solution I also get that
_InterlockedCompareExchange64_HLEAcquire is implicitly declared, and the
same link error.

Any advice on something I am doing wrong or ways to fix this would be
appreciated. For the curious, full branch of CPython is
https://github.com/ethanhs/cpython/tree/clang-cl . The usage of these
intrinsics is in pyatomic.h.

Thanks so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180522/1e6a6602/attachment.html>


More information about the cfe-dev mailing list