[PATCH] D40545: [sanitizer] add msvc atomic_compare_exchange_strong for sint32_t
comicfans44 via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 04:15:30 PST 2017
comicfans44 created this revision.
comicfans44 added a project: Sanitizers.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.
It is short enough , so just a copy/paste from uint32_t
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D40545
Files:
compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
Index: compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h
@@ -240,6 +240,19 @@
return false;
}
+INLINE bool atomic_compare_exchange_strong(volatile atomic_sint32_t *a,
+ s32 *cmp,
+ s32 xchg,
+ memory_order mo) {
+ s32 cmpv = *cmp;
+ s32 prev = (s32)_InterlockedCompareExchange(
+ (volatile long*)&a->val_dont_use, (long)xchg, (long)cmpv);
+ if (prev == cmpv)
+ return true;
+ *cmp = prev;
+ return false;
+}
+
INLINE bool atomic_compare_exchange_strong(volatile atomic_uint64_t *a,
u64 *cmp,
u64 xchg,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40545.124541.patch
Type: text/x-patch
Size: 933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171128/9bcbca91/attachment.bin>
More information about the llvm-commits
mailing list