* typecheck_real_to_currency: generate inline round() node instead of direct call to fpc_round_real, this allows target-specific processing to take place and possibly emit more efficient code.

* Provide x86_64 SSE versions of fpc_trunc_real and fpc_round_real, strictly they are not necessary after the above change to code generation, but it still reduces size of system unit by avoiding compilation of related generic code.

git-svn-id: trunk@25735 -
This commit is contained in:
sergei 2013-10-10 12:46:51 +00:00
parent 849843fb20
commit 90d66595c2
2 changed files with 17 additions and 3 deletions

View File

@ -294,7 +294,7 @@ implementation
globtype,systems,constexp,
cutils,verbose,globals,widestr,
symconst,symdef,symsym,symtable,
ncon,ncal,nset,nadd,nmem,nmat,nbas,nutils,
ncon,ncal,nset,nadd,nmem,nmat,nbas,nutils,ninl,
cgbase,procinfo,
htypechk,pass_1,cpuinfo;
@ -1428,8 +1428,7 @@ implementation
result:=cordconstnode.create(round(trealconstnode(left).value_real),resultdef,false)
else
begin
result:=ccallnode.createinternres('fpc_round_real',
ccallparanode.create(left,nil),resultdef);
result:=cinlinenode.create(in_round_real,false,left);
left:=nil;
end;
end;

View File

@ -272,4 +272,19 @@ const
power:=exp(ln(bas)*expo);
end;
{$endif FPC_SYSTEM_HAS_POWER}
{$else FPC_HAS_TYPE_EXTENDED}
{$define FPC_SYSTEM_HAS_TRUNC}
function fpc_trunc_real(d : ValReal) : int64;compilerproc; assembler; nostackframe;
asm
cvttsd2si %xmm0,%rax;
end;
{$define FPC_SYSTEM_HAS_ROUND}
function fpc_round_real(d : ValReal) : int64;compilerproc; assembler; nostackframe;
asm
cvtsd2si %xmm0,%rax;
end;
{$endif FPC_HAS_TYPE_EXTENDED}