Charles Davis | d82bf2d | 2010-02-05 20:45:48 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 2 | |
| 3 | void __attribute__((fastcall)) f1(void); |
| 4 | void __attribute__((stdcall)) f2(void); |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 5 | void __attribute__((thiscall)) f3(void); |
| 6 | void __attribute__((fastcall)) f4(void) { |
| 7 | // CHECK: define x86_fastcallcc void @f4() |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 8 | f1(); |
Charles Davis | d82bf2d | 2010-02-05 20:45:48 +0000 | [diff] [blame] | 9 | // CHECK: call x86_fastcallcc void @f1() |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 10 | } |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 11 | void __attribute__((stdcall)) f5(void) { |
| 12 | // CHECK: define x86_stdcallcc void @f5() |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 13 | f2(); |
Charles Davis | d82bf2d | 2010-02-05 20:45:48 +0000 | [diff] [blame] | 14 | // CHECK: call x86_stdcallcc void @f2() |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 15 | } |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 16 | void __attribute__((thiscall)) f6(void) { |
| 17 | // CHECK: define x86_thiscallcc void @f6() |
| 18 | f3(); |
| 19 | // CHECK: call x86_thiscallcc void @f3() |
| 20 | } |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 21 | |
Charles Davis | 16c4f3c | 2010-02-05 18:13:10 +0000 | [diff] [blame] | 22 | // PR5280 |
| 23 | void (__attribute__((fastcall)) *pf1)(void) = f1; |
| 24 | void (__attribute__((stdcall)) *pf2)(void) = f2; |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 25 | void (__attribute__((thiscall)) *pf3)(void) = f3; |
| 26 | void (__attribute__((fastcall)) *pf4)(void) = f4; |
| 27 | void (__attribute__((stdcall)) *pf5)(void) = f5; |
| 28 | void (__attribute__((thiscall)) *pf6)(void) = f6; |
Charles Davis | 16c4f3c | 2010-02-05 18:13:10 +0000 | [diff] [blame] | 29 | |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 30 | int main(void) { |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 31 | 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 McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 36 | // CHECK: call x86_fastcallcc void %{{.*}}() |
| 37 | // CHECK: call x86_stdcallcc void %{{.*}}() |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 38 | // CHECK: call x86_thiscallcc void %{{.*}}() |
John McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 39 | // CHECK: call x86_fastcallcc void %{{.*}}() |
| 40 | // CHECK: call x86_stdcallcc void %{{.*}}() |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 41 | // CHECK: call x86_thiscallcc void %{{.*}}() |
Anton Korobeynikov | f1c9c09 | 2008-11-11 20:21:14 +0000 | [diff] [blame] | 42 | return 0; |
| 43 | } |
| 44 | |
Eli Friedman | 9a0fcfe | 2010-05-17 02:50:18 +0000 | [diff] [blame] | 45 | // PR7117 |
Douglas Gregor | f813a2c | 2010-05-18 16:57:00 +0000 | [diff] [blame] | 46 | void __attribute((stdcall)) f7(foo) int foo; {} |
| 47 | void f8(void) { |
| 48 | f7(0); |
Eli Friedman | 9a0fcfe | 2010-05-17 02:50:18 +0000 | [diff] [blame] | 49 | // CHECK: call x86_stdcallcc void (...)* bitcast |
| 50 | } |