• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
8 // CDECL: define void @_Z5test1v
9 // FASTCALL: define x86_fastcallcc void @_Z5test1v
10 // STDCALL: define x86_stdcallcc void @_Z5test1v
11 // VECTORCALL: define x86_vectorcallcc void @_Z5test1v
12 // REGCALL: define x86_regcallcc void @_Z17__regcall3__test1v
test1()13 void test1() {}
14 
15 // fastcall, stdcall, vectorcall and regcall do not support variadic functions.
16 // CDECL: define void @_Z12testVariadicz
17 // FASTCALL: define void @_Z12testVariadicz
18 // STDCALL: define void @_Z12testVariadicz
19 // VECTORCALL: define void @_Z12testVariadicz
20 // REGCALL: define void @_Z12testVariadicz
testVariadic(...)21 void testVariadic(...){}
22 
23 // ALL: define void @_Z5test2v
test2()24 void __attribute__((cdecl)) test2() {}
25 
26 // ALL: define x86_fastcallcc void @_Z5test3v
test3()27 void __attribute__((fastcall)) test3() {}
28 
29 // ALL: define x86_stdcallcc void @_Z5test4v
test4()30 void __attribute__((stdcall)) test4() {}
31 
32 // ALL: define  x86_vectorcallcc void @_Z5test5v
test5()33 void __attribute__((vectorcall)) test5() {}
34 
35 // ALL: define x86_regcallcc void @_Z17__regcall3__test6v
test6()36 void __attribute__((regcall)) test6() {}
37 
38 // ALL: define linkonce_odr void @_ZN1A11test_memberEv
39 class A {
40 public:
test_member()41   void test_member() {}
42 };
43 
test()44 void test() {
45   A a;
46   a.test_member();
47 }
48 
49 // ALL: define i32 @main
main()50 int main() {
51   return 1;
52 }
53