blob: 6f3b003287719ae7f700cdd256a19fe5509f680b [file] [log] [blame]
Charles Davisd82bf2d2010-02-05 20:45:48 +00001// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +00002
3void __attribute__((fastcall)) f1(void);
4void __attribute__((stdcall)) f2(void);
Douglas Gregorf813a2c2010-05-18 16:57:00 +00005void __attribute__((thiscall)) f3(void);
6void __attribute__((fastcall)) f4(void) {
7// CHECK: define x86_fastcallcc void @f4()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +00008 f1();
Charles Davisd82bf2d2010-02-05 20:45:48 +00009// CHECK: call x86_fastcallcc void @f1()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000010}
Douglas Gregorf813a2c2010-05-18 16:57:00 +000011void __attribute__((stdcall)) f5(void) {
12// CHECK: define x86_stdcallcc void @f5()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000013 f2();
Charles Davisd82bf2d2010-02-05 20:45:48 +000014// CHECK: call x86_stdcallcc void @f2()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000015}
Douglas Gregorf813a2c2010-05-18 16:57:00 +000016void __attribute__((thiscall)) f6(void) {
17// CHECK: define x86_thiscallcc void @f6()
18 f3();
19// CHECK: call x86_thiscallcc void @f3()
20}
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000021
Charles Davis16c4f3c2010-02-05 18:13:10 +000022// PR5280
23void (__attribute__((fastcall)) *pf1)(void) = f1;
24void (__attribute__((stdcall)) *pf2)(void) = f2;
Douglas Gregorf813a2c2010-05-18 16:57:00 +000025void (__attribute__((thiscall)) *pf3)(void) = f3;
26void (__attribute__((fastcall)) *pf4)(void) = f4;
27void (__attribute__((stdcall)) *pf5)(void) = f5;
28void (__attribute__((thiscall)) *pf6)(void) = f6;
Charles Davis16c4f3c2010-02-05 18:13:10 +000029
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000030int main(void) {
Douglas Gregorf813a2c2010-05-18 16:57:00 +000031 f4(); f5(); f6();
32 // CHECK: call x86_fastcallcc void @f4()
33 // CHECK: call x86_stdcallcc void @f5()
34 // CHECK: call x86_thiscallcc void @f6()
35 pf1(); pf2(); pf3(); pf4(); pf5(); pf6();
John McCall04a67a62010-02-05 21:31:56 +000036 // CHECK: call x86_fastcallcc void %{{.*}}()
37 // CHECK: call x86_stdcallcc void %{{.*}}()
Douglas Gregorf813a2c2010-05-18 16:57:00 +000038 // CHECK: call x86_thiscallcc void %{{.*}}()
John McCall04a67a62010-02-05 21:31:56 +000039 // CHECK: call x86_fastcallcc void %{{.*}}()
40 // CHECK: call x86_stdcallcc void %{{.*}}()
Douglas Gregorf813a2c2010-05-18 16:57:00 +000041 // CHECK: call x86_thiscallcc void %{{.*}}()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000042 return 0;
43}
44
Eli Friedman9a0fcfe2010-05-17 02:50:18 +000045// PR7117
Douglas Gregorf813a2c2010-05-18 16:57:00 +000046void __attribute((stdcall)) f7(foo) int foo; {}
47void f8(void) {
48 f7(0);
Eli Friedman9a0fcfe2010-05-17 02:50:18 +000049 // CHECK: call x86_stdcallcc void (...)* bitcast
50}