diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2012-10-04 20:18:38 +0000 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2012-10-04 20:18:38 +0000 |
commit | 61e404e36c914476938db67d873a0df32c6c3a9c (patch) | |
tree | 8681047432552966f624dd3e58125423b45deb4a | |
parent | e20e508aecf413f84b0dc4928cbf4bb5ce6c5bdc (diff) |
Add a test case for r156143, which enabled general varargs support for the
64-bit PPC SVR4 ABI.
The test verifies passing of structures, items with 16-byte alignment, and
small items that are passed right-justified in the parameter save area slot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165245 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CodeGen/ppc64-varargs-struct.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/ppc64-varargs-struct.c b/test/CodeGen/ppc64-varargs-struct.c new file mode 100644 index 0000000000..c007656111 --- /dev/null +++ b/test/CodeGen/ppc64-varargs-struct.c @@ -0,0 +1,32 @@ +// REQUIRES: ppc64-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s + +#include <stdarg.h> + +struct x { + long a; + double b; +}; + +void testva (int n, ...) +{ + va_list ap; + + struct x t = va_arg (ap, struct x); +// CHECK: bitcast i8* %ap.cur{{[0-9]*}} to %struct.x* +// CHECK: bitcast %struct.x* %t to i8* +// CHECK: bitcast %struct.x* %{{[0-9]+}} to i8* +// CHECK: call void @llvm.memcpy + + __int128_t u = va_arg (ap, __int128_t); +// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64 +// CHECK: add i64 %{{[0-9]+}}, 15 +// CHECK: and i64 %{{[0-9]+}}, 4294967280 +// CHECK: inttoptr i64 %{{[0-9]+}} to i8* + + int v = va_arg (ap, int); +// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64 +// CHECK: add i64 %{{[0-9]+}}, 4 +// CHECK: inttoptr i64 %{{[0-9]+}} to i8* +// CHECK: bitcast i8* %{{[0-9]+}} to i32* +} |