Răsfoiți Sursa

+ set pi_do_call on loongarch64 as well if we check for fpu exceptions

florian 1 an în urmă
părinte
comite
421d67556a
2 a modificat fișierele cu 22 adăugiri și 0 ștergeri
  1. 13 0
      compiler/loongarch64/ncpuadd.pas
  2. 9 0
      compiler/loongarch64/ncpuinl.pas

+ 13 - 0
compiler/loongarch64/ncpuadd.pas

@@ -47,6 +47,7 @@ unit ncpuadd;
         procedure second_cmpfloat;override;
       public
         function use_generic_mul32to64: boolean; override;
+        function pass_1 : tnode;override;
       end;
 
 
@@ -396,6 +397,18 @@ implementation
         result:=false;
       end;
 
+    function tloongarch64addnode.pass_1: tnode;
+      begin
+        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;
+      end;
+
 begin
   caddnode := tloongarch64addnode;
 end.

+ 9 - 0
compiler/loongarch64/ncpuinl.pas

@@ -59,6 +59,7 @@ implementation
       aasmtai,aasmdata,aasmcpu,
       symconst,symdef,
       defutil,
+      procinfo,
       cgbase,pass_2,
       cpuinfo,ncgutil,
       hlcgobj,cgutils,cgobj,rgobj,tgobj;
@@ -72,6 +73,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;
 
 
@@ -86,6 +89,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;
 
 
@@ -93,6 +98,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;
 
 
@@ -100,6 +107,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;