Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1746)

Unified Diff: test/Transforms/NaCl/atomics.ll

Issue 22474008: Add the new @llvm.nacl.atomic.fence.all intrinsic (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Add note suggested by jvoung. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/NaCl/PNaClABI/intrinsics.ll ('k') | test/Transforms/NaCl/remove-asm-memory.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/Transforms/NaCl/atomics.ll
diff --git a/test/Transforms/NaCl/atomics.ll b/test/Transforms/NaCl/atomics.ll
index b124241062ab1980dafd20bd71fc359936b1169c..96b2b7d6e16803acd17e2d1a0f87bf955d6295e0 100644
--- a/test/Transforms/NaCl/atomics.ll
+++ b/test/Transforms/NaCl/atomics.ll
@@ -1,4 +1,4 @@
-; RUN: opt -nacl-rewrite-atomics -S < %s | FileCheck %s
+; RUN: opt -nacl-rewrite-atomics -remove-asm-memory -S < %s | FileCheck %s
; Each of these tests validates that the corresponding legacy GCC-style
; builtins are properly rewritten to NaCl atomic builtins. Only the
@@ -210,11 +210,44 @@ define i64 @test_val_compare_and_swap_i64(i64* %ptr, i64 %oldval, i64 %newval) {
ret i64 %res
}
+; This patterns gets emitted by C11/C++11 atomic thread fences.
+;
+; CHECK: @test_c11_fence
+define void @test_c11_fence() {
+ ; CHECK-NEXT: call void @llvm.nacl.atomic.fence(i32 6)
+ ; CHECK-NEXT: ret void
+ fence seq_cst
+ ret void
+}
+
+; This pattern gets emitted for ``__sync_synchronize`` and
+; ``asm("":::"memory")`` when Clang is configured for NaCl.
+;
; CHECK: @test_synchronize
define void @test_synchronize() {
- ; CHECK-NEXT: call void @llvm.nacl.atomic.fence(i32 6)
+ ; CHECK-NEXT: call void @llvm.nacl.atomic.fence.all()
; CHECK-NEXT: ret void
+ call void asm sideeffect "", "~{memory}"()
+ fence seq_cst
+ call void asm sideeffect "", "~{memory}"()
+ ret void
+}
+
+; Make sure the above pattern is respected and not partially-matched.
+;
+; CHECK: @test_synchronize_bad1
+define void @test_synchronize_bad1() {
+ ; CHECK-NOT: call void @llvm.nacl.atomic.fence.all()
+ call void asm sideeffect "", "~{memory}"()
+ fence seq_cst
+ ret void
+}
+
+; CHECK: @test_synchronize_bad2
+define void @test_synchronize_bad2() {
+ ; CHECK-NOT: call void @llvm.nacl.atomic.fence.all()
fence seq_cst
+ call void asm sideeffect "", "~{memory}"()
ret void
}
« no previous file with comments | « test/NaCl/PNaClABI/intrinsics.ll ('k') | test/Transforms/NaCl/remove-asm-memory.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698