* fixed longint -> real, was broken in 6153

git-svn-id: trunk@6257 -
This commit is contained in:
florian 2007-01-28 21:27:21 +00:00
parent 31636e3887
commit 0fd3498892

View File

@ -122,26 +122,35 @@ implementation
l1,l2 : tasmlabel;
hregister : tregister;
begin
current_asmdata.getdatalabel(l1);
current_asmdata.getjumplabel(l2);
reference_reset_symbol(href,l1,0);
{ convert first to double to avoid precision loss }
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
location_force_reg(current_asmdata.CurrAsmList,left.location,OS_32,true);
location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
instr:=taicpu.op_reg_reg(A_FLT,location.register,left.location.register);
if is_signed(left.resultdef) then
begin
instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resultdef)];;
current_asmdata.CurrAsmList.concat(instr);
end
else
begin
{ flt does a signed load, fix this }
case tfloatdef(resultdef).floattype of
s32real,
s64real:
begin
{ converting dword to s64real first and cut off at the end avoids precision loss }
instr.oppostfix:=PF_D;
current_asmdata.CurrAsmList.concat(instr);
current_asmdata.getdatalabel(l1);
current_asmdata.getjumplabel(l2);
reference_reset_symbol(href,l1,0);
current_asmdata.CurrAsmList.concat(Taicpu.op_reg_const(A_CMP,left.location.register,0));
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_GE,l2);
case tfloatdef(resultdef).floattype of
{ converting dword to s64real first and cut off at the end avoids precision loss }
s32real,
s64real:
begin
hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64);
current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(8)));
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1));
@ -165,6 +174,7 @@ implementation
internalerror(200410031);
end;
end;
end;
procedure tarmtypeconvnode.second_int_to_bool;