annotate tests/mini/callingconv1.d @ 1630:44b145be2ef5

Merge dmd 1.056.
author Robert Clipsham <robert@octarineparrot.com>
date Sat, 06 Feb 2010 15:53:52 +0000
parents e92e14690a4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
1 module mini.callingconv1;
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
2
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
3 extern(C) int printf(char*, ...);
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
4
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
5 float foo(float a, float b)
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
6 {
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
7 return a + b;
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
8 }
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
9
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
10 void main()
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
11 {
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
12 float a = 1.5;
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
13 float b = 2.5;
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
14 float c;
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
15
1034
12b423e17860 Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents: 741
diff changeset
16 version(D_InlineAsm_X86)
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
17 {
1448
e92e14690a4f change mingw32 versioning to version(Windows)
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1447
diff changeset
18 version(Windows)
1447
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
19 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
20 asm
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
21 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
22 movss XMM0, [a];
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
23 movss XMM1, [b];
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
24 movss [ESP], XMM1;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
25 movss [ESP]+4, XMM0;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
26 call foo;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
27 fstp [c]-4;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
28 movss XMM0, [c]-4;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
29 movss [c], XMM0;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
30 }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
31 } else
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
32 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
33
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
34 asm
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
35 {
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
36 mov EAX, [a];
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
37 push EAX;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
38 mov EAX, [b];
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
39 push EAX;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
40 call foo;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
41 fstp c;
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
42 }
a400b1dd657f fix assembly code for mingw32 in minitests
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents: 1034
diff changeset
43 }
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
44 }
1034
12b423e17860 Adjust mini tests to use D_InlineAsm
Christian Kamm <kamm incasoftware de>
parents: 741
diff changeset
45 else version(D_InlineAsm_X86_64)
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
46 {
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
47 asm
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
48 {
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
49 movss XMM0, [a];
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
50 movss XMM1, [b];
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
51 call foo;
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
52 movss [c], XMM0;
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
53 }
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
54 }
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
55 printf("%f\n", c);
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
56
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
57 assert(c == 4.0);
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
58
741
4ac97ec7c18e Applied easy part from wilsonk's x86-64 patch in #107
Christian Kamm <kamm incasoftware de>
parents: 526
diff changeset
59 printf("passed %f\n", c);
526
642f6fa854e5 First step towards D abi compliance.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
60 }