summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-04-07 16:41:47 +0000
committerHans Wennborg <hans@hanshq.net>2017-04-07 16:41:47 +0000
commit5c3c51fe052a64407c147b6d8607cbc3c3e0d697 (patch)
tree111d264c958b5df7f1d7453603a4475f95048133 /clang/test/CodeGen
parent70a26e93a9870ab5f35b0f82c53ded7dfd8f7785 (diff)
downloadbcm5719-llvm-5c3c51fe052a64407c147b6d8607cbc3c3e0d697.tar.gz
bcm5719-llvm-5c3c51fe052a64407c147b6d8607cbc3c3e0d697.zip
Implement _interlockedbittestandset as a builtin
It's used by MS headers in VS 2017 without including intrin.h, so we can't implement it in the header anymore. Differential Revision: https://reviews.llvm.org/D31736 llvm-svn: 299782
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/ms-intrinsics.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ms-intrinsics.c b/clang/test/CodeGen/ms-intrinsics.c
index 2d4ca5c272a..06d85890128 100644
--- a/clang/test/CodeGen/ms-intrinsics.c
+++ b/clang/test/CodeGen/ms-intrinsics.c
@@ -434,6 +434,17 @@ __int64 test_InterlockedDecrement64(__int64 volatile *Addend) {
#endif
+unsigned char test_interlockedbittestandset(volatile long *ptr, long bit) {
+ return _interlockedbittestandset(ptr, bit);
+}
+// CHECK-LABEL: define{{.*}} i8 @test_interlockedbittestandset
+// CHECK: %0 = shl i32 1, %bit
+// CHECK: %1 = atomicrmw or i32* %ptr, i32 %0 seq_cst
+// CHECK: %2 = lshr i32 %1, %bit
+// CHECK: %3 = trunc i32 %2 to i8
+// CHECK: %4 = and i8 %3, 1
+// CHECK: ret i8 %4
+
void test__fastfail() {
__fastfail(42);
}
OpenPOWER on IntegriCloud