1 // RUN: %clang_cc1 -triple i386-pc-elfiamcu -emit-llvm %s -o - | FileCheck %s
3 // Structure that is more than 8 byte.
8 // Empty union with zero size must be returned as void.
12 // Too large union (80 bytes) must be returned via memory.
17 // Must be returned in register.
22 // Empty struct with zero size, must be returned as void.
26 // Must be returend in register.
31 // CHECK: [[UNION1_TYPE:%.+]] = type {}
32 // CHECK: [[UNION2_TYPE:%.+]] = type { [[STRUCT_TYPE:%.+]] }
33 // CHECK: [[STRUCT_TYPE]] = type { [10 x double] }
34 // CHECK: [[UNION3_TYPE:%.+]] = type { i32 }
35 // CHECK: [[STRUCT1_TYPE:%.+]] = type {}
36 // CHECK: [[STRUCT2_TYPE:%.+]] = type { i32 }
38 union U1
foo1(void) { return u1
; }
39 union U2
foo2(void) { return u2
; }
40 union U3
foo3(void) { return u3
; }
41 struct S1
bar1(void) { return s1
; }
42 struct S2
bar2(void) { return s2
; }
43 struct S1
bar3(union U1 u
) { return s1
; }
44 // CHECK: define{{.*}} void @foo1()
45 // CHECK: define{{.*}} void @foo2(ptr dead_on_unwind noalias writable sret([[UNION2_TYPE]]) align 4 %{{.+}})
46 // CHECK: define{{.*}} i32 @foo3()
47 // CHECK: define{{.*}} void @bar1()
48 // CHECK: define{{.*}} i32 @bar2()
49 // CHECK: define{{.*}} void @bar3()
55 struct S1 y1
= bar1();
56 struct S2 y2
= bar2();
57 struct S1 y3
= bar3(x1
);
59 // CHECK: [[X1:%.+]] = alloca [[UNION1_TYPE]]
60 // CHECK: [[X2:%.+]] = alloca [[UNION2_TYPE]]
61 // CHECK: [[X3:%.+]] = alloca [[UNION3_TYPE]]
62 // CHECK: [[Y1:%.+]] = alloca [[STRUCT1_TYPE]]
63 // CHECK: [[Y2:%.+]] = alloca [[STRUCT2_TYPE]]
64 // CHECK: call void @foo1()
65 // CHECK: call void @foo2(ptr dead_on_unwind writable sret([[UNION2_TYPE]]) align 4 [[X2]])
66 // CHECK: {{.+}} = call i32 @foo3()
67 // CHECK: call void @bar1()
68 // CHECK: {{.+}} = call i32 @bar2()
69 // CHECK: call void @bar3()