1 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s | FileCheck %s --check-prefix=CDECL --check-prefix=ALL
2 // RUN: %clang_cc1 -triple i786-unknown-linux-gnu -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s | FileCheck %s --check-prefix=FASTCALL --check-prefix=ALL
3 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -fdefault-calling-conv=stdcall -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
4 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
5 // RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=vectorcall -emit-llvm -o - %s | FileCheck %s --check-prefix=VECTORCALL --check-prefix=ALL
6 // RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=regcall -emit-llvm -o - %s | FileCheck %s --check-prefix=REGCALL --check-prefix=ALL
7 // RUN: %clang_cc1 -triple i686-pc-win32 -fdefault-calling-conv=vectorcall -emit-llvm -o - %s -DWINDOWS | FileCheck %s --check-prefix=WIN32
8 // RUN: %clang_cc1 -triple x86_64-windows-msvc -fdefault-calling-conv=vectorcall -emit-llvm -o - %s -DWINDOWS | FileCheck %s --check-prefix=WIN64
9 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm -o - %s -DEXPLICITCC | FileCheck %s --check-prefix=EXPLICITCC
11 // CDECL: define{{.*}} void @_Z5test1v
12 // FASTCALL: define{{.*}} x86_fastcallcc void @_Z5test1v
13 // STDCALL: define{{.*}} x86_stdcallcc void @_Z5test1v
14 // VECTORCALL: define{{.*}} x86_vectorcallcc void @_Z5test1v
15 // REGCALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test1v
18 // fastcall, stdcall, vectorcall and regcall do not support variadic functions.
19 // CDECL: define{{.*}} void @_Z12testVariadicz
20 // FASTCALL: define{{.*}} void @_Z12testVariadicz
21 // STDCALL: define{{.*}} void @_Z12testVariadicz
22 // VECTORCALL: define{{.*}} void @_Z12testVariadicz
23 // REGCALL: define{{.*}} void @_Z12testVariadicz
24 void testVariadic(...){}
26 // ALL: define{{.*}} void @_Z5test2v
27 void __attribute__((cdecl)) test2() {}
29 // ALL: define{{.*}} x86_fastcallcc void @_Z5test3v
30 void __attribute__((fastcall
)) test3() {}
32 // ALL: define{{.*}} x86_stdcallcc void @_Z5test4v
33 void __attribute__((stdcall)) test4() {}
35 // ALL: define{{.*}} x86_vectorcallcc void @_Z5test5v
36 void __attribute__((vectorcall
)) test5() {}
38 // ALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v
39 void __attribute__((regcall
)) test6() {}
41 // ALL: define linkonce_odr void @_ZN1A11test_memberEv
52 // ALL: define{{.*}} i32 @main
58 // WIN32: define dso_local noundef i32 @wmain
59 // WIN64: define dso_local noundef i32 @wmain
63 // WIN32: define dso_local x86_stdcallcc noundef i32 @WinMain
64 // WIN64: define dso_local noundef i32 @WinMain
68 // WIN32: define dso_local x86_stdcallcc noundef i32 @wWinMain
69 // WIN64: define dso_local noundef i32 @wWinMain
73 // WIN32: define dso_local x86_stdcallcc noundef i32 @DllMain
74 // WIN64: define dso_local noundef i32 @DllMain
81 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wmain
82 int __fastcall
wmain() {
85 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @WinMain
86 int __fastcall
WinMain() {
89 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wWinMain
90 int __fastcall
wWinMain() {
93 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @DllMain
94 int __fastcall
DllMain() {