From 23919b4de40f4135258440672e6c1670d14c8b18 Mon Sep 17 00:00:00 2001 From: Kelly Wilson Date: Sun, 31 May 2009 11:01:02 -0600 Subject: [PATCH] fix assembly code for mingw32 in minitests --- tests/mini/callingconv1.d | 35 ++++++++++++++++++++++++++--------- tests/mini/naked_asm5.d | 14 +++++++++++--- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/tests/mini/callingconv1.d b/tests/mini/callingconv1.d index 6a584ece..9bd840fc 100644 --- a/tests/mini/callingconv1.d +++ b/tests/mini/callingconv1.d @@ -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) { diff --git a/tests/mini/naked_asm5.d b/tests/mini/naked_asm5.d index db438acb..b9d527c7 100644 --- a/tests/mini/naked_asm5.d +++ b/tests/mini/naked_asm5.d @@ -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) {