diff options
author | Dan Gohman <sunfish@google.com> | 2014-02-21 16:09:43 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@google.com> | 2014-02-24 17:32:54 -0800 |
commit | f6e2fddff6294c1c2ec2f9602c30ff680359ed19 (patch) | |
tree | 2b0ff77983e789a89259ad66918b1248c7893ab6 /test/CodeGenCXX | |
parent | a963b803407c9d1cac644cc425004e0ccd28fa45 (diff) |
Introduce the asmjs-unknown-emscripten target triple.
Notable changes from le32-unknown-nacl so far include:
- Set i32 as the legal integer set, to help the optimizer avoid creating
needlessly inefficient code for asm.js.
- We can use llvm.pow.
- Don't predefine __ELF__ or __pnacl__ so that we don't need to undefine
them later.
- Do predefine asm.js and Emscripten macros, so that we don't need to
define them later.
- Don't provide __has_feature(pnacl).
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r-- | test/CodeGenCXX/member-function-pointers.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/static-init-emscripten.cpp | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp index 23a7b0009f..c29f0e75e5 100644 --- a/test/CodeGenCXX/member-function-pointers.cpp +++ b/test/CodeGenCXX/member-function-pointers.cpp @@ -6,6 +6,8 @@ // PNaCl uses the same representation of method pointers as ARM. // RUN: %clang_cc1 %s -emit-llvm -o - -triple=le32-unknown-nacl | FileCheck -check-prefix GLOBAL-ARM %s +// Emscripten uses the same representation of method pointers as ARM. +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=asmjs-unknown-emscripten | FileCheck -check-prefix GLOBAL-ARM %s struct A { int a; void f(); virtual void vf1(); virtual void vf2(); }; struct B { int b; virtual void g(); }; 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 |