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