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 i32 %{{.*}} 7
15 // AAPCS: and i32 %{{.*}} -8
16 // APCS-GNU-NOT: add i32 %{{.*}} 7
17 // APCS-GNU-NOT: and i32 %{{.*}} -8
18 long long ll = __builtin_va_arg(ap, long long);
22 double t2(int i, ...) {
26 __builtin_va_start(ap, i);
27 // AAPCS: add i32 %{{.*}} 7
28 // AAPCS: and i32 %{{.*}} -8
29 // APCS-GNU-NOT: add i32 %{{.*}} 7
30 // APCS-GNU-NOT: and i32 %{{.*}} -8
31 double ll = __builtin_va_arg(ap, double);