From a736a4bba7c7151ad58edb776c51eca69e787cdd Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 16 Feb 2024 22:48:01 +0100 Subject: [PATCH] + set pi_do_call on RiscV as well if we check for fpu exceptions --- compiler/riscv/nrvadd.pas | 8 ++++++++ compiler/riscv/nrvinl.pas | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/compiler/riscv/nrvadd.pas b/compiler/riscv/nrvadd.pas index 408ede75ff..6609c4dd24 100644 --- a/compiler/riscv/nrvadd.pas +++ b/compiler/riscv/nrvadd.pas @@ -303,6 +303,14 @@ implementation else Result:=inherited pass_1; + { if the result is not nil, a new node has been generated and the current node will be discarted } + if Result=nil then + begin + if left.resultdef.typ=floatdef then + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); + end; + if expectloc=LOC_FLAGS then expectloc:=LOC_REGISTER; if (expectloc=LOC_JUMP) diff --git a/compiler/riscv/nrvinl.pas b/compiler/riscv/nrvinl.pas index 155d52242b..98064c1834 100644 --- a/compiler/riscv/nrvinl.pas +++ b/compiler/riscv/nrvinl.pas @@ -65,6 +65,7 @@ implementation aasmtai,aasmdata,aasmcpu, symconst,symdef, defutil, + procinfo, cgbase,pass_2, cpuinfo,ncgutil, hlcgobj,cgutils,cgobj,rgobj,tgobj; @@ -80,6 +81,8 @@ implementation begin expectloc:=LOC_FPUREGISTER; first_sqrt_real := nil; + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); end else result:=inherited first_sqrt_real; @@ -104,6 +107,8 @@ implementation begin expectloc:=LOC_FPUREGISTER; first_sqr_real := nil; + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); end else result:=inherited first_sqr_real; @@ -116,6 +121,8 @@ implementation begin expectloc:=LOC_FPUREGISTER; first_round_real := nil; + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); end else result:=inherited first_round_real; @@ -128,6 +135,8 @@ implementation begin expectloc:=LOC_FPUREGISTER; first_trunc_real := nil; + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); end else result:=inherited first_trunc_real; @@ -136,6 +145,8 @@ implementation function trvinlinenode.first_fma: tnode; begin + if needs_check_for_fpu_exceptions then + Include(current_procinfo.flags,pi_do_call); Result:=nil; end;