* x86: improve x87 qword to float conversion, using single-precision constants saves space and removes need in separate load on FPU stack. No precision loss occurs because 2**64 is representable exactly even in single precision.

git-svn-id: trunk@26941 -
This commit is contained in:
sergei 2014-03-03 20:41:42 +00:00
parent 2ae138d95c
commit d613ab8578

View File

@ -389,8 +389,9 @@ implementation
begin
{ unsigned 64 bit ints are harder to handle:
we load bits 0..62 and then check bit 63:
if it is 1 then we add $80000000 000000000
as double }
if it is 1 then we add 2**64 as float.
Since 2**64 can be represented exactly, use a single-precision
constant to save space. }
current_asmdata.getdatalabel(l1);
current_asmdata.getjumplabel(l2);
@ -430,13 +431,10 @@ implementation
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,l1.name,const_align(sizeof(pint)));
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1));
{ I got this constant from a test program (FK) }
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(0));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint ($80000000)));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($0000403f));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($5f800000));
reference_reset_symbol(href,l1,0,4);
tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,href);
current_asmdata.CurrAsmList.concat(Taicpu.Op_ref(A_FLD,S_FX,href));
current_asmdata.CurrAsmList.concat(Taicpu.Op_reg_reg(A_FADDP,S_NO,NR_ST,NR_ST1));
current_asmdata.CurrAsmList.concat(Taicpu.Op_ref(A_FADD,S_FS,href));
cg.a_label(current_asmdata.CurrAsmList,l2);
end
else