fix assembly code for mingw32 in minitests

This commit is contained in:
Kelly Wilson
2009-05-31 11:01:02 -06:00
parent 2fe8f2cd74
commit 23919b4de4
2 changed files with 37 additions and 12 deletions

View File

@@ -15,15 +15,32 @@ void main()
version(D_InlineAsm_X86)
{
asm
{
mov EAX, [a];
push EAX;
mov EAX, [b];
push EAX;
call foo;
fstp c;
}
version(mingw32)
{
asm
{
movss XMM0, [a];
movss XMM1, [b];
movss [ESP], XMM1;
movss [ESP]+4, XMM0;
call foo;
fstp [c]-4;
movss XMM0, [c]-4;
movss [c], XMM0;
}
} else
{
asm
{
mov EAX, [a];
push EAX;
mov EAX, [b];
push EAX;
call foo;
fstp c;
}
}
}
else version(D_InlineAsm_X86_64)
{

View File

@@ -3,9 +3,17 @@ int foo(int op)(int a, int b)
version(X86)
{
const OP = (op == '+') ? "add" : "sub";
asm { naked; }
mixin("asm{"~OP~" EAX, [ESP+4];}");
asm { ret 4; }
version (mingw32)
{
asm { naked; }
mixin("asm{push EBP;mov EBP,ESP;sub ESP,8;mov ECX,[EBP+8];"~OP~" EAX, ECX;add ESP,8;pop EBP;}");
asm { ret; }
} else
{
asm { naked; }
mixin("asm{"~OP~" EAX, [ESP+4];}");
asm { ret 4; }
}
}
else version(X86_64)
{