blob: 15b4a992d1ecc82523553d18b0dae2842f384a7c [file] [log] [blame]
Duncan Sands972378a2008-05-14 09:46:01 +00001// RUN: %llvmgxx -S -O1 -m32 -emit-llvm %s -o - | grep {store i32} | count 1
Dale Johannesen84ad8372008-02-13 18:36:48 +00002
Dale Johannesen35e11cd2008-02-15 22:05:15 +00003// Test that all 8 bytes of ret in check242 are copied, and only 4 bytes of
4// ret in check93 are copied (the same LLVM struct is used for both).
5
Dale Johannesen84ad8372008-02-13 18:36:48 +00006typedef __builtin_va_list va_list;
7typedef unsigned long size_t;
8void *memset(void *, int, size_t);
9struct S92 { int a:14; } ;
10 extern struct S92 s92;
11
12 struct S92 check92 () { struct S92 ret;
13 memset (&ret, 0, sizeof (ret));
14 ret.a = s92.a;
15 return ret; }
16
17struct S93 { __attribute__((aligned (8))) void * a; } ;
18 extern struct S93 s93;
19 struct S93 check93 () {
20 struct S93 ret;
21 memset (&ret, 0, sizeof (ret));
22 ret.a = s93.a;
23 return ret; }
24
25struct S242 { char * a;int b[1]; } ;
26 extern struct S242 s242;
27
28 struct S242 check242 () {
29 struct S242 ret;
30 memset (&ret, 0, sizeof (ret));
31 ret.a = s242.a;
32 ret.b[0] = s242.b[0];
33 return ret; }
34
35void check93va (int z, ...) {
36 struct S93 arg;
37 va_list ap;
38 __builtin_va_start(ap,z);
39 arg = __builtin_va_arg(ap,struct S93);
40 __builtin_va_end(ap); }
41
42void check242va (int z, ...) {
43struct S242 arg;
44va_list ap;
45__builtin_va_start(ap,z);
46 arg = __builtin_va_arg(ap,struct S242);
47 __builtin_va_end(ap); }
48