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

Unified Diff: test/CodeGenCXX/static-init-emscripten.cpp

Issue 1022123003: clang: add support for asmjs arch and Emscripten OS (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-clang.git@master
Patch Set: Address comments. Created 5 years, 9 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/CodeGenCXX/member-function-pointers.cpp ('k') | test/Driver/asmjs-unknown-emscripten.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/CodeGenCXX/static-init-emscripten.cpp
diff --git a/test/CodeGenCXX/static-init-emscripten.cpp b/test/CodeGenCXX/static-init-emscripten.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b9d0271ae1b4ed5fc37efdc92b7837f67575df2f
--- /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
« no previous file with comments | « test/CodeGenCXX/member-function-pointers.cpp ('k') | test/Driver/asmjs-unknown-emscripten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698