1// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-REG
2// RUN: %clang_cc1 -triple i386-apple-darwin9 -fpcc-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PCC
3// RUN: %clang_cc1 -triple i386-apple-darwin9 -freg-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-REG
4// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PCC
5// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fpcc-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PCC
6// RUN: %clang_cc1 -triple i386-pc-linux-gnu -freg-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-REG
7// RUN: %clang_cc1 -triple i386-pc-win32 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-REG
8// RUN: %clang_cc1 -triple i386-pc-win32 -fpcc-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PCC
9// RUN: %clang_cc1 -triple i386-pc-win32 -freg-struct-return -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-REG
10
11typedef struct { int a,b,c,d; } Big;
12typedef struct { int i; } Small;
13typedef struct { short s; } Short;
14typedef struct { } ZeroSized;
15
16// CHECK-LABEL: define void @returnBig
17// CHECK: ret void
18Big returnBig(Big x) { return x; }
19
20// CHECK-PCC-LABEL: define void @returnSmall
21// CHECK-PCC: ret void
22// CHECK-REG-LABEL: define i32 @returnSmall
23// CHECK-REG: ret i32
24Small returnSmall(Small x) { return x; }
25
26// CHECK-PCC-LABEL: define void @returnShort
27// CHECK-PCC: ret void
28// CHECK-REG-LABEL: define i16 @returnShort
29// CHECK-REG: ret i16
30Short returnShort(Short x) { return x; }
31
32// CHECK-LABEL: define void @returnZero()
33// CHECK: ret void
34ZeroSized returnZero(ZeroSized x) { return x; }
35