aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/static-init-emscripten.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-25 12:25:39 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-25 12:25:39 -0800
commit2a5c6e40d0a9d279750f84a3678c3e4d23061301 (patch)
tree7714a0b54ab9b3fb492b0c79505671b1310ff8d8 /test/CodeGenCXX/static-init-emscripten.cpp
parentec1178a11d6dbeb371f45dd94a1d1c0849bbf1cb (diff)
parent632c823b8bfd3fd5a4b77628eddd6161c5d8367e (diff)
Merge branch 'master' of github.com:sunfishcode/emscripten-fastcomp-clang into incoming
Diffstat (limited to 'test/CodeGenCXX/static-init-emscripten.cpp')
-rw-r--r--test/CodeGenCXX/static-init-emscripten.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/CodeGenCXX/static-init-emscripten.cpp b/test/CodeGenCXX/static-init-emscripten.cpp
new file mode 100644
index 0000000000..b9d0271ae1
--- /dev/null
+++ b/test/CodeGenCXX/static-init-emscripten.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm -triple=asmjs-unknown-emscripten -o - %s | FileCheck %s
+
+int f();
+
+// Test that Emscripten uses the Itanium/x86 ABI in which the static
+// variable's guard variable is tested via "load i8 and compare with
+// zero" rather than the ARM ABI which uses "load i32 and test the
+// bottom bit".
+void g() {
+ static int a = f();
+}
+// CHECK: load atomic i8* bitcast (i64* @_ZGVZ1gvE1a to i8*) acquire
+// CHECK-NEXT: %guard.uninitialized = icmp eq i8 %0, 0
+// CHECK-NEXT: br i1 %guard.uninitialized, label %init.check, label %init.end