diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGen/arm-vaarg-align.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGen/arm-vaarg-align.c')
-rw-r--r-- | clang/test/CodeGen/arm-vaarg-align.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/CodeGen/arm-vaarg-align.c b/clang/test/CodeGen/arm-vaarg-align.c new file mode 100644 index 0000000..1187c02 --- /dev/null +++ b/clang/test/CodeGen/arm-vaarg-align.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -triple arm -target-abi aapcs %s -emit-llvm -o - | FileCheck -check-prefix=AAPCS %s +// RUN: %clang_cc1 -triple arm -target-abi apcs-gnu %s -emit-llvm -o - | FileCheck -check-prefix=APCS-GNU %s +/* + * Check that va_arg accesses stack according to ABI alignment + * long long and double require 8-byte alignment under AAPCS + * however, they only require 4-byte alignment under APCS + */ +long long t1(int i, ...) { + // AAPCS: t1 + // APCS-GNU: t1 + __builtin_va_list ap; + __builtin_va_start(ap, i); + // AAPCS: add i32 %{{.*}} 7 + // AAPCS: and i32 %{{.*}} -8 + // APCS-GNU-NOT: add i32 %{{.*}} 7 + // APCS-GNU-NOT: and i32 %{{.*}} -8 + long long ll = __builtin_va_arg(ap, long long); + __builtin_va_end(ap); + return ll; +} +double t2(int i, ...) { + // AAPCS: t2 + // APCS-GNU: t2 + __builtin_va_list ap; + __builtin_va_start(ap, i); + // AAPCS: add i32 %{{.*}} 7 + // AAPCS: and i32 %{{.*}} -8 + // APCS-GNU-NOT: add i32 %{{.*}} 7 + // APCS-GNU-NOT: and i32 %{{.*}} -8 + double ll = __builtin_va_arg(ap, double); + __builtin_va_end(ap); + return ll; +} |