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 
11 typedef struct { int a,b,c,d; } Big;
12 typedef struct { int i; } Small;
13 typedef struct { short s; } Short;
14 typedef struct { } ZeroSized;
15 
16 // CHECK-LABEL: define void @returnBig
17 // CHECK: ret void
returnBig(Big x)18 Big returnBig(Big x) { return x; }
19 
20 // CHECK-PCC-LABEL: define {{(dso_local )?}}void @returnSmall
21 // CHECK-PCC: ret void
22 // CHECK-REG-LABEL: define {{(dso_local )?}}i32 @returnSmall
23 // CHECK-REG: ret i32
returnSmall(Small x)24 Small returnSmall(Small x) { return x; }
25 
26 // CHECK-PCC-LABEL: define {{(dso_local )?}}void @returnShort
27 // CHECK-PCC: ret void
28 // CHECK-REG-LABEL: define {{(dso_local )?}}i16 @returnShort
29 // CHECK-REG: ret i16
returnShort(Short x)30 Short returnShort(Short x) { return x; }
31 
32 // CHECK-LABEL: define void @returnZero()
33 // CHECK: ret void
returnZero(ZeroSized x)34 ZeroSized returnZero(ZeroSized x) { return x; }
35