Browse Source

Fix the init state of LoongArch FPU exception bit

Jinyang He 2 years ago
parent
commit
706aefb2aa
1 changed files with 2 additions and 10 deletions
  1. 2 10
      rtl/loongarch64/loongarch64.inc

+ 2 - 10
rtl/loongarch64/loongarch64.inc

@@ -139,7 +139,7 @@ procedure SysInitFPU;
   begin
   begin
     setrm(0);
     setrm(0);
     setcause(0);
     setcause(0);
-    setenables(fpu_z or fpu_v);
+    setenables(fpu_z or fpu_v or fpu_o);
     softfloat_exception_mask:=[exPrecision,exUnderflow];
     softfloat_exception_mask:=[exPrecision,exUnderflow];
     softfloat_exception_flags:=[];
     softfloat_exception_flags:=[];
   end;
   end;
@@ -509,18 +509,10 @@ procedure Move(const source;var dest;count:SizeInt);[public, alias: 'FPC_MOVE'];
 
 
 {$define FPC_SYSTEM_HAS_SYSRESETFPU}
 {$define FPC_SYSTEM_HAS_SYSRESETFPU}
 procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
 procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
-{$ifdef FPUFD}
-var
-  cw: TNativeFPUControlWord;
-{$endif}
 begin
 begin
   softfloat_exception_flags:=[];
   softfloat_exception_flags:=[];
   softfloat_exception_mask:=[exPrecision,exUnderflow];
   softfloat_exception_mask:=[exPrecision,exUnderflow];
 {$ifdef FPUFD}
 {$ifdef FPUFD}
-  cw:=GetNativeFPUControlWord;
-  cw.cw:=0;
-  { round to nearest }
-  cw.rndmode:=0;
-  SetNativeFPUControlWord(cw);
+  SetNativeFPUControlWord(DefaultFPUControlWord);
 {$endif}
 {$endif}
 end;
 end;