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