1 // REQUIRES: arm-registered-target
2 // RUN: %clang_cc1 -triple arm -target-abi aapcs %s -emit-llvm -o - | FileCheck -check-prefix=AAPCS %s
3 // RUN: %clang_cc1 -triple arm -target-abi apcs-gnu %s -emit-llvm -o - | FileCheck -check-prefix=APCS-GNU %s
5 * Check that va_arg accesses stack according to ABI alignment
6 * long long and double require 8-byte alignment under AAPCS
7 * however, they only require 4-byte alignment under APCS
9 long long t1(int i
, ...) {
13 __builtin_va_start(ap
, i
);
14 // AAPCS: [[ADD:%.*]] = getelementptr inbounds i8, ptr %argp.cur, i32 7
15 // AAPCS = call ptr @llvm.ptrmask.p0.i32(ptr [[ADD]], i32 -8)
17 // APCS-GNU-NOT: getelementptr {{.*}}, i32 7
18 // APCS-GNU-NOT: llvm.ptrmask.p0
19 long long ll
= __builtin_va_arg(ap
, long long);
23 double t2(int i
, ...) {
27 __builtin_va_start(ap
, i
);
28 // AAPCS: [[ADD:%.*]] = getelementptr inbounds i8, ptr %argp.cur, i32 7
29 // AAPCS = call ptr @llvm.ptrmask.p0.i32(ptr [[ADD]], i32 -8)
31 // APCS-GNU-NOT: getelementptr {{.*}}, i32 7
32 // APCS-GNU-NOT: llvm.ptrmask.p0
33 double ll
= __builtin_va_arg(ap
, double);