blob: 46fe326fadfa6a753107de6ab5ed0545386c76d5 [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);
5void __attribute__((fastcall)) f3(void) {
Charles Davisd82bf2d2010-02-05 20:45:48 +00006// CHECK: define x86_fastcallcc void @f3()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +00007 f1();
Charles Davisd82bf2d2010-02-05 20:45:48 +00008// CHECK: call x86_fastcallcc void @f1()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +00009}
10void __attribute__((stdcall)) f4(void) {
Charles Davisd82bf2d2010-02-05 20:45:48 +000011// CHECK: define x86_stdcallcc void @f4()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000012 f2();
Charles Davisd82bf2d2010-02-05 20:45:48 +000013// CHECK: call x86_stdcallcc void @f2()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000014}
15
Charles Davis16c4f3c2010-02-05 18:13:10 +000016// PR5280
17void (__attribute__((fastcall)) *pf1)(void) = f1;
18void (__attribute__((stdcall)) *pf2)(void) = f2;
19void (__attribute__((fastcall)) *pf3)(void) = f3;
20void (__attribute__((stdcall)) *pf4)(void) = f4;
21
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000022int main(void) {
23 f3(); f4();
Charles Davisd82bf2d2010-02-05 20:45:48 +000024 // CHECK: call x86_fastcallcc void @f3()
25 // CHECK: call x86_stdcallcc void @f4()
Charles Davis16c4f3c2010-02-05 18:13:10 +000026 pf1(); pf2(); pf3(); pf4();
John McCall04a67a62010-02-05 21:31:56 +000027 // CHECK: call x86_fastcallcc void %{{.*}}()
28 // CHECK: call x86_stdcallcc void %{{.*}}()
29 // CHECK: call x86_fastcallcc void %{{.*}}()
30 // CHECK: call x86_stdcallcc void %{{.*}}()
Anton Korobeynikovf1c9c092008-11-11 20:21:14 +000031 return 0;
32}
33
Eli Friedman9a0fcfe2010-05-17 02:50:18 +000034// PR7117
35void __attribute((stdcall)) f5(foo) int foo; {}
36void f6(void) {
37 f5(0);
38 // CHECK: call x86_stdcallcc void (...)* bitcast
39}