فهرست منبع

* unify SysInitFPU and SysResetFPU on RiscV

florian 6 ماه پیش
والد
کامیت
ca53c5e7d4
3فایلهای تغییر یافته به همراه38 افزوده شده و 59 حذف شده
  1. 38 0
      rtl/riscv/riscv.inc
  2. 0 20
      rtl/riscv32/riscv32.inc
  3. 0 39
      rtl/riscv64/riscv64.inc

+ 38 - 0
rtl/riscv/riscv.inc

@@ -119,3 +119,41 @@ procedure fpc_throwfpuexception;[public,alias:'FPC_THROWFPUEXCEPTION'];
       RaisePendingExceptions;
   end;
 {$endif FPUFD}
+
+
+{$define FPC_SYSTEM_HAS_SYSINITFPU}
+procedure SysInitFPU;
+{$ifdef FPUFD}
+var
+  cw: TNativeFPUControlWord;
+{$endif}
+begin
+  softfloat_exception_flags:=[];
+  softfloat_exception_mask:=[exPrecision,exUnderflow];
+{$ifdef FPUFD}
+  cw:=GetNativeFPUControlWord;
+  { riscv does not support triggering exceptions when FPU exceptions happen;
+    it merely records which exceptions have happened until now -> clear }
+  cw.cw:=0;
+  { round to nearest }
+  cw.rndmode:=0;
+  SetNativeFPUControlWord(cw);
+{$endif}
+end;
+
+
+{$define FPC_SYSTEM_HAS_SYSRESETFPU}
+Procedure SysResetFPU;
+{$ifdef FPUFD}
+var
+  cw: TNativeFPUControlWord;
+{$endif}
+begin
+  softfloat_exception_flags:=[];
+{$ifdef FPUFD}
+  { clear all "exception happened" flags we care about}
+  cw:=GetNativeFPUControlWord;
+  cw.cw:=0;
+  SetNativeFPUControlWord(cw);
+{$endif FPUFD}
+end;

+ 0 - 20
rtl/riscv32/riscv32.inc

@@ -87,23 +87,3 @@ function fpc_atomic_cmp_xchg_32 (var Target: longint; NewValue: longint; Compara
   end;
 
 
-{$define FPC_SYSTEM_HAS_SYSRESETFPU}
-procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
-{$ifdef FPUFD}
-var
-  cw: TNativeFPUControlWord;
-{$endif}
-begin
-  softfloat_exception_flags:=[];
-  softfloat_exception_mask:=[exPrecision,exUnderflow];
-{$ifdef FPUFD}
-  cw:=GetNativeFPUControlWord;
-  { riscv does not support triggering exceptions when FPU exceptions happen;
-    it merely records which exceptions have happened until now -> clear }
-  cw.cw:=0;
-  { round to nearest }
-  cw.rndmode:=0;
-  SetNativeFPUControlWord(cw);
-{$endif}
-end;
-

+ 0 - 39
rtl/riscv64/riscv64.inc

@@ -303,42 +303,3 @@ procedure WriteBarrier; assembler; nostackframe;
   asm
     fence ow, ow
   end;
-
-
-{$define FPC_SYSTEM_HAS_SYSINITFPU}
-procedure SysInitFPU;
-{$ifdef FPUFD}
-var
-  cw: TNativeFPUControlWord;
-{$endif}
-begin
-  softfloat_exception_flags:=[];
-  softfloat_exception_mask:=[exPrecision,exUnderflow];
-{$ifdef FPUFD}
-  cw:=GetNativeFPUControlWord;
-  { riscv does not support triggering exceptions when FPU exceptions happen;
-    it merely records which exceptions have happened until now -> clear }
-  cw.cw:=0;
-  { round to nearest }
-  cw.rndmode:=0;
-  SetNativeFPUControlWord(cw);
-{$endif}
-end;
-
-
-{$define FPC_SYSTEM_HAS_SYSRESETFPU}
-Procedure SysResetFPU;
-{$ifdef FPUFD}
-var
-  cw: TNativeFPUControlWord;
-{$endif}
-begin
-  softfloat_exception_flags:=[];
-  softfloat_exception_mask:=[exPrecision,exUnderflow];
-{$ifdef FPUFD}
-  { clear all "exception happened" flags we care about}
-  cw:=GetNativeFPUControlWord;
-  cw.cw:=0;
-  SetNativeFPUControlWord(cw);
-{$endif FPUFD}
-end;