Mercurial > projects > ldc
comparison tests/mini/callingconv1.d @ 526:642f6fa854e5
First step towards D abi compliance.
Framepointer elimination is now disabled for functions using inline asm (with a hack from aKor).
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 20:18:01 +0200 |
parents | |
children | 4ac97ec7c18e |
comparison
equal
deleted
inserted
replaced
525:b18b6135e54b | 526:642f6fa854e5 |
---|---|
1 module mini.callingconv1; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 float foo(float a, float b) | |
6 { | |
7 return a + b; | |
8 } | |
9 | |
10 void main() | |
11 { | |
12 float a = 1.5; | |
13 float b = 2.5; | |
14 float c; | |
15 | |
16 asm | |
17 { | |
18 mov EAX, [a]; | |
19 push EAX; | |
20 mov EAX, [b]; | |
21 push EAX; | |
22 call foo; | |
23 fstp c; | |
24 } | |
25 | |
26 printf("%f\n", c); | |
27 | |
28 assert(c == 4.0); | |
29 | |
30 printf("passed\n", c); | |
31 } |