comparison tests/mini/naked_asm5.d @ 1447:a400b1dd657f

fix assembly code for mingw32 in minitests
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Sun, 31 May 2009 11:01:02 -0600
parents 1b10a9c6e3e8
children e92e14690a4f
comparison
equal deleted inserted replaced
1446:fe151804995a 1447:a400b1dd657f
1 int foo(int op)(int a, int b) 1 int foo(int op)(int a, int b)
2 { 2 {
3 version(X86) 3 version(X86)
4 { 4 {
5 const OP = (op == '+') ? "add" : "sub"; 5 const OP = (op == '+') ? "add" : "sub";
6 asm { naked; } 6 version (mingw32)
7 mixin("asm{"~OP~" EAX, [ESP+4];}"); 7 {
8 asm { ret 4; } 8 asm { naked; }
9 mixin("asm{push EBP;mov EBP,ESP;sub ESP,8;mov ECX,[EBP+8];"~OP~" EAX, ECX;add ESP,8;pop EBP;}");
10 asm { ret; }
11 } else
12 {
13 asm { naked; }
14 mixin("asm{"~OP~" EAX, [ESP+4];}");
15 asm { ret 4; }
16 }
9 } 17 }
10 else version(X86_64) 18 else version(X86_64)
11 { 19 {
12 const OP = (op == '+') ? "add" : "sub"; 20 const OP = (op == '+') ? "add" : "sub";
13 asm { naked; } 21 asm { naked; }