ppc32-and-aix-struct-return.c
3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
// RUN: %clang_cc1 -triple powerpc-unknown-aix \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
// RUN: %clang_cc1 -triple powerpc64-unknown-aix \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
// RUN: %clang_cc1 -triple powerpc-unknown-linux \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
// RUN: %clang_cc1 -triple powerpc-unknown-openbsd \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -maix-struct-return \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -msvr4-struct-return \
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
typedef struct {
} Zero;
typedef struct {
char c;
} One;
typedef struct {
short s;
} Two;
typedef struct {
char c[3];
} Three;
typedef struct {
float f;
} Four; // svr4 to return i32, not float
typedef struct {
char c[5];
} Five;
typedef struct {
short s[3];
} Six;
typedef struct {
char c[7];
} Seven;
typedef struct {
int i;
char c;
} Eight; // padded for alignment
typedef struct {
char c[9];
} Nine;
// CHECK-AIX-LABEL: define void @ret0(%struct.Zero* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define void @ret0()
Zero ret0(void) { return (Zero){}; }
// CHECK-AIX-LABEL: define void @ret1(%struct.One* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i8 @ret1()
One ret1(void) { return (One){'a'}; }
// CHECK-AIX-LABEL: define void @ret2(%struct.Two* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i16 @ret2()
Two ret2(void) { return (Two){123}; }
// CHECK-AIX-LABEL: define void @ret3(%struct.Three* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i24 @ret3()
Three ret3(void) { return (Three){"abc"}; }
// CHECK-AIX-LABEL: define void @ret4(%struct.Four* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i32 @ret4()
Four ret4(void) { return (Four){0.4}; }
// CHECK-AIX-LABEL: define void @ret5(%struct.Five* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i40 @ret5()
Five ret5(void) { return (Five){"abcde"}; }
// CHECK-AIX-LABEL: define void @ret6(%struct.Six* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i48 @ret6()
Six ret6(void) { return (Six){12, 34, 56}; }
// CHECK-AIX-LABEL: define void @ret7(%struct.Seven* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i56 @ret7()
Seven ret7(void) { return (Seven){"abcdefg"}; }
// CHECK-AIX-LABEL: define void @ret8(%struct.Eight* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define i64 @ret8()
Eight ret8(void) { return (Eight){123, 'a'}; }
// CHECK-AIX-LABEL: define void @ret9(%struct.Nine* noalias sret {{[^,]*}})
// CHECK-SVR4-LABEL: define void @ret9(%struct.Nine* noalias sret {{[^,]*}})
Nine ret9(void) { return (Nine){"abcdefghi"}; }