From 4cd15058dfa27ecdab70b4c9eae8d6747de8e50d Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 23 Sep 2007 14:23:31 +0000 Subject: [PATCH] * take care of the used fpu instruction set when saving/restoring function results on x86 git-svn-id: trunk@8617 - --- compiler/ncgadd.pas | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index 20139d30b6..fd9618638d 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -136,14 +136,26 @@ interface end; if pushedfpu then begin - tmpreg := cg.getfpuregister(current_asmdata.CurrAsmList,left.location.size); - cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location.size,left.location,tmpreg); - location_reset(left.location,LOC_FPUREGISTER,left.location.size); - left.location.register := tmpreg; {$ifdef x86} - { left operand is now on top of the stack, instead of the right one! } - toggleflag(nf_swapped); + if use_sse(left.resultdef) then + begin + tmpreg := cg.getmmregister(current_asmdata.CurrAsmList,left.location.size); + cg.a_loadmm_loc_reg(current_asmdata.CurrAsmList,left.location.size,left.location,tmpreg,mms_movescalar); + location_reset(left.location,LOC_MMREGISTER,left.location.size); + left.location.register := tmpreg; + end {$endif x86} + else + begin + tmpreg := cg.getfpuregister(current_asmdata.CurrAsmList,left.location.size); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location.size,left.location,tmpreg); + location_reset(left.location,LOC_FPUREGISTER,left.location.size); + left.location.register := tmpreg; +{$ifdef x86} + { left operand is now on top of the stack, instead of the right one! } + toggleflag(nf_swapped); +{$endif x86} + end; end; end; @@ -248,7 +260,7 @@ interface tmpreg : tregister; mask, setbase : aint; - + cgop : TOpCg; opdone : boolean; begin