1 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s | FileCheck %s --check-prefix=CDECL --check-prefix=X86 --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=X86 --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=X86 --check-prefix=ALL
4 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=X86 --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=X86 --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=X86 --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
10 // RUN: %clang_cc1 -triple m68k-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=RTDCALL --check-prefix=ALL
11 // RUN: %clang_cc1 -triple m68k-unknown-linux-gnu -fdefault-calling-conv=rtdcall -emit-llvm -o - %s | FileCheck %s --check-prefix=RTDCALL --check-prefix=ALL
13 // CDECL: define{{.*}} void @_Z5test1v
14 // FASTCALL: define{{.*}} x86_fastcallcc void @_Z5test1v
15 // STDCALL: define{{.*}} x86_stdcallcc void @_Z5test1v
16 // VECTORCALL: define{{.*}} x86_vectorcallcc void @_Z5test1v
17 // REGCALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test1v
18 // RTDCALL: define{{.*}} m68k_rtdcc void @_Z5test1v
21 // fastcall, stdcall, vectorcall, regcall and m68k_rtd do not support variadic functions.
22 // CDECL: define{{.*}} void @_Z12testVariadicz
23 // FASTCALL: define{{.*}} void @_Z12testVariadicz
24 // STDCALL: define{{.*}} void @_Z12testVariadicz
25 // VECTORCALL: define{{.*}} void @_Z12testVariadicz
26 // REGCALL: define{{.*}} void @_Z12testVariadicz
27 // RTDCALL: define{{.*}} void @_Z12testVariadicz
28 void testVariadic(...){}
30 // X86: define{{.*}} void @_Z5test2v
31 void __attribute__((cdecl)) test2() {}
33 // X86: define{{.*}} x86_fastcallcc void @_Z5test3v
34 void __attribute__((fastcall
)) test3() {}
36 // X86: define{{.*}} x86_stdcallcc void @_Z5test4v
37 void __attribute__((stdcall)) test4() {}
39 // X86: define{{.*}} x86_vectorcallcc void @_Z5test5v
40 void __attribute__((vectorcall
)) test5() {}
42 // X86: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v
43 void __attribute__((regcall
)) test6() {}
45 // RTDCALL: define{{.*}} m68k_rtdcc void @_Z5test7v
46 void __attribute__((m68k_rtd
)) test7() {}
48 // ALL: define linkonce_odr void @_ZN1A11test_memberEv
58 // ALL: define internal void @"_ZZ{{.*}}testvENK3$_0clEi"
59 auto f
= [](int b
) {};
63 // ALL: define{{.*}} i32 @main
69 // WIN32: define dso_local noundef i32 @wmain
70 // WIN64: define dso_local noundef i32 @wmain
74 // WIN32: define dso_local x86_stdcallcc noundef i32 @WinMain
75 // WIN64: define dso_local noundef i32 @WinMain
79 // WIN32: define dso_local x86_stdcallcc noundef i32 @wWinMain
80 // WIN64: define dso_local noundef i32 @wWinMain
84 // WIN32: define dso_local x86_stdcallcc noundef i32 @DllMain
85 // WIN64: define dso_local noundef i32 @DllMain
92 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wmain
93 int __fastcall
wmain() {
96 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @WinMain
97 int __fastcall
WinMain() {
100 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wWinMain
101 int __fastcall
wWinMain() {
104 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @DllMain
105 int __fastcall
DllMain() {