diff options
-rw-r--r-- | compiler/aarch64/ncpuinl.pas | 48 | ||||
-rw-r--r-- | rtl/aarch64/math.inc | 11 |
2 files changed, 47 insertions, 12 deletions
diff --git a/compiler/aarch64/ncpuinl.pas b/compiler/aarch64/ncpuinl.pas index 26fd698dae..1ea4537b3b 100644 --- a/compiler/aarch64/ncpuinl.pas +++ b/compiler/aarch64/ncpuinl.pas @@ -36,6 +36,7 @@ interface function first_round_real: tnode; override; function first_trunc_real: tnode; override; function first_int_real: tnode; override; + function first_frac_real: tnode; override; function first_fma : tnode; override; procedure second_abs_real; override; procedure second_sqr_real; override; @@ -44,6 +45,7 @@ interface procedure second_round_real; override; procedure second_trunc_real; override; procedure second_int_real; override; + procedure second_frac_real; override; procedure second_get_frame; override; procedure second_fma; override; procedure second_prefetch; override; @@ -112,21 +114,29 @@ implementation function taarch64inlinenode.first_int_real : tnode; begin - expectloc:=LOC_MMREGISTER; - result:=nil; + expectloc:=LOC_MMREGISTER; + result:=nil; end; - function taarch64inlinenode.first_fma : tnode; - begin - if ((is_double(resultdef)) or (is_single(resultdef))) then - begin - expectloc:=LOC_MMREGISTER; - Result:=nil; - end - else - Result:=inherited first_fma; - end; + function taarch64inlinenode.first_frac_real : tnode; + begin + expectloc:=LOC_MMREGISTER; + result:=nil; + end; + + + function taarch64inlinenode.first_fma : tnode; + begin + if ((is_double(resultdef)) or (is_single(resultdef))) then + begin + expectloc:=LOC_MMREGISTER; + Result:=nil; + end + else + Result:=inherited first_fma; + end; + procedure taarch64inlinenode.second_abs_real; begin @@ -209,6 +219,20 @@ implementation end; + procedure taarch64inlinenode.second_frac_real; + var + hreg: tregister; + begin + secondpass(left); + hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true); + location_reset(location,LOC_MMREGISTER,def_cgsize(resultdef)); + location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRINTZ,location.register,left.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FSUB,location.register,left.location.register,location.register)); + cg.maybe_check_for_fpu_exception(current_asmdata.CurrAsmList); + end; + + procedure taarch64inlinenode.second_get_frame; begin location_reset(location,LOC_CREGISTER,OS_ADDR); diff --git a/rtl/aarch64/math.inc b/rtl/aarch64/math.inc index de98808322..a526128870 100644 --- a/rtl/aarch64/math.inc +++ b/rtl/aarch64/math.inc @@ -72,6 +72,17 @@ end; {$endif FPC_SYSTEM_HAS_TRUNC} +{$ifndef VER3_2} + {$ifndef FPC_SYSTEM_HAS_FRAC} + {$define FPC_SYSTEM_HAS_FRAC} + function fpc_frac_real(d : ValReal) : ValReal;compilerproc; + begin + { Function is handled internal in the compiler } + runerror(207); + result:=0; + end; + {$endif FPC_SYSTEM_HAS_FRAC} +{$endif VER3_2} {$ifndef FPC_SYSTEM_HAS_ROUND} {$define FPC_SYSTEM_HAS_ROUND} |