blob: c007656111fd5dc780be2fcf70e4e9afc1e8f1a6 [file] [log] [blame]
Bill Schmidt61e404e2012-10-04 20:18:38 +00001// REQUIRES: ppc64-registered-target
2// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
3
4#include <stdarg.h>
5
6struct x {
7 long a;
8 double b;
9};
10
11void testva (int n, ...)
12{
13 va_list ap;
14
15 struct x t = va_arg (ap, struct x);
16// CHECK: bitcast i8* %ap.cur{{[0-9]*}} to %struct.x*
17// CHECK: bitcast %struct.x* %t to i8*
18// CHECK: bitcast %struct.x* %{{[0-9]+}} to i8*
19// CHECK: call void @llvm.memcpy
20
21 __int128_t u = va_arg (ap, __int128_t);
22// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64
23// CHECK: add i64 %{{[0-9]+}}, 15
24// CHECK: and i64 %{{[0-9]+}}, 4294967280
25// CHECK: inttoptr i64 %{{[0-9]+}} to i8*
26
27 int v = va_arg (ap, int);
28// CHECK: ptrtoint i8* %ap.cur{{[0-9]*}} to i64
29// CHECK: add i64 %{{[0-9]+}}, 4
30// CHECK: inttoptr i64 %{{[0-9]+}} to i8*
31// CHECK: bitcast i8* %{{[0-9]+}} to i32*
32}