xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/static-init-pnacl.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple=le32-unknown-nacl -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int f();
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // Test that PNaCl uses the Itanium/x86 ABI in which the static
6*f4a2713aSLionel Sambuc // variable's guard variable is tested via "load i8 and compare with
7*f4a2713aSLionel Sambuc // zero" rather than the ARM ABI which uses "load i32 and test the
8*f4a2713aSLionel Sambuc // bottom bit".
g()9*f4a2713aSLionel Sambuc void g() {
10*f4a2713aSLionel Sambuc   static int a = f();
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc // CHECK: [[LOAD:%.*]] = load atomic i8* bitcast (i64* @_ZGVZ1gvE1a to i8*) acquire
13*f4a2713aSLionel Sambuc // CHECK-NEXT: [[GUARD:%.*]] = icmp eq i8 [[LOAD]], 0
14*f4a2713aSLionel Sambuc // CHECK-NEXT: br i1 [[GUARD]]
15