[PATCH] D36071: [builtins] Use _Interlocked* intrinsics for atomics on MSVC

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 06:29:36 PDT 2017


marsupial added inline comments.


================
Comment at: lib/builtins/emutls.c:219
 #else
-    return (uintptr_t) _load_be_u32(ptr);
+    return _InterlockedAdd64(ptr, 0);
+#endif
----------------
mstorsjo wrote:
> X64 doesn't have `Add64`, but have got `Or64_np`. ARM (and according to MSVC 2017's `intrin.h`, ARM64 as well) have got `Add64` though.
The docs for these functions say it returns the original value.
Should be fine as 0 is added/ored, but a comment explaining the situation may be wise.


https://reviews.llvm.org/D36071





More information about the llvm-commits mailing list