From bfef399519ca9b8a4b4c6b563253bad7e0eeffe0 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/CodeGenCXX/static-init-pnacl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/CodeGenCXX/static-init-pnacl.cpp (limited to 'test/CodeGenCXX/static-init-pnacl.cpp') diff --git a/test/CodeGenCXX/static-init-pnacl.cpp b/test/CodeGenCXX/static-init-pnacl.cpp new file mode 100644 index 000000000000..de35ec3847fa --- /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:%.*]] = load atomic i8* bitcast (i64* @_ZGVZ1gvE1a to i8*) acquire +// CHECK-NEXT: [[GUARD:%.*]] = icmp eq i8 [[LOAD]], 0 +// CHECK-NEXT: br i1 [[GUARD]] -- cgit v1.3