aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-12 15:19:54 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-12 15:19:54 -0700
commit99a5501f5ae5b75017dfc386d4abf648234e85df (patch)
treea662eae5ea83e9317fb6ae61f0eaea005bd4d1f0 /test
parent3fd9ccdd9f8d259bcf518e7056cfd419d992e984 (diff)
parentf69ebb4201da8bb5045f9335150ed6ef6bcfc2cc (diff)
Merge branch 'master' of http://git.chromium.org/native_client/pnacl-clang
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/le32-libcall-pow.c21
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp3
-rw-r--r--test/CodeGenCXX/static-init-pnacl.cpp14
3 files changed, 38 insertions, 0 deletions
diff --git a/test/CodeGen/le32-libcall-pow.c b/test/CodeGen/le32-libcall-pow.c
new file mode 100644
index 0000000000..c2f892c3ae
--- /dev/null
+++ b/test/CodeGen/le32-libcall-pow.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fmath-errno -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
+
+// le32 (PNaCl) never generates intrinsics for pow calls, with or without errno
+
+// CHECK: define void @test_pow
+void test_pow(float a0, double a1, long double a2) {
+ // CHECK: call float @powf
+ float l0 = powf(a0, a0);
+
+ // CHECK: call double @pow
+ double l1 = pow(a1, a1);
+
+ // CHECK: call double @powl
+ long double l2 = powl(a2, a2);
+}
+
+// CHECK: declare float @powf(float, float)
+// CHECK: declare double @pow(double, double)
+// CHECK: declare double @powl(double, double)
+
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp
index 84b54b67d3..23a7b0009f 100644
--- a/test/CodeGenCXX/member-function-pointers.cpp
+++ b/test/CodeGenCXX/member-function-pointers.cpp
@@ -4,6 +4,9 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-unknown-unknown | FileCheck -check-prefix GLOBAL-LP32 %s
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-unknown | FileCheck -check-prefix GLOBAL-ARM %s
+// 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
+
struct A { int a; void f(); virtual void vf1(); virtual void vf2(); };
struct B { int b; virtual void g(); };
struct C : B, A { };
diff --git a/test/CodeGenCXX/static-init-pnacl.cpp b/test/CodeGenCXX/static-init-pnacl.cpp
new file mode 100644
index 0000000000..65844e5d34
--- /dev/null
+++ b/test/CodeGenCXX/static-init-pnacl.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm -triple=le32-unknown-nacl -o - %s | FileCheck %s
+
+int f();
+
+// Test that PNaCl 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