[cfe-commits] r165245 - /cfe/trunk/test/CodeGen/ppc64-varargs-struct.c

Bill Schmidt wschmidt at linux.vnet.ibm.com
Thu Oct 4 13:18:39 PDT 2012


Author: wschmidt
Date: Thu Oct  4 15:18:38 2012
New Revision: 165245

URL: http://llvm.org/viewvc/llvm-project?rev=165245&view=rev
Log:
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.

Added:
    cfe/trunk/test/CodeGen/ppc64-varargs-struct.c

Added: cfe/trunk/test/CodeGen/ppc64-varargs-struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc64-varargs-struct.c?rev=165245&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ppc64-varargs-struct.c (added)
+++ cfe/trunk/test/CodeGen/ppc64-varargs-struct.c Thu Oct  4 15:18:38 2012
@@ -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*
+}





More information about the cfe-commits mailing list