+ inlined support for round/trunc on AArch64

git-svn-id: trunk@29923 -
This commit is contained in:
Jonas Maebe 2015-02-23 22:53:07 +00:00
parent 0203f5e32f
commit 5da379ab3f

View File

@ -33,10 +33,14 @@ interface
function first_abs_real: tnode; override;
function first_sqr_real: tnode; override;
function first_sqrt_real: tnode; override;
function first_round_real: tnode; override;
function first_trunc_real: tnode; override;
procedure second_abs_real; override;
procedure second_sqr_real; override;
procedure second_sqrt_real; override;
procedure second_abs_long; override;
procedure second_round_real; override;
procedure second_trunc_real; override;
private
procedure load_fpu_location;
end;
@ -85,6 +89,20 @@ implementation
end;
function taarch64inlinenode.first_round_real: tnode;
begin
expectloc:=LOC_MMREGISTER;
result:=nil;
end;
function taarch64inlinenode.first_trunc_real: tnode;
begin
expectloc:=LOC_MMREGISTER;
result:=nil;
end;
procedure taarch64inlinenode.second_abs_real;
begin
load_fpu_location;
@ -121,6 +139,34 @@ implementation
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_cond(A_CSEL,location.register,location.register,left.location.register,C_GE));
end;
procedure taarch64inlinenode.second_round_real;
var
hreg: tregister;
begin
secondpass(left);
hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
hreg:=cg.getmmregister(current_asmdata.CurrAsmList,left.location.size);
{ round as floating point using current rounding mode }
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRINTX,hreg,left.location.register));
{ convert to signed integer rounding towards zero (there's no "round to
integer using current rounding mode") }
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCVTZS,location.register,hreg));
end;
procedure taarch64inlinenode.second_trunc_real;
begin
secondpass(left);
hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
{ convert to signed integer rounding towards zero }
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCVTZS,location.register,left.location.register));
end;
begin
cinlinenode:=taarch64inlinenode;
end.