* simplify SysResetFPU

This commit is contained in:
florian 2024-12-06 21:20:33 +01:00
parent 4d67cd80fc
commit 73e96f8f1e
2 changed files with 14 additions and 15 deletions

View File

@ -90,7 +90,7 @@ begin
softfloat_exception_mask:=[exPrecision,exUnderflow];
{$ifdef FPUFD}
cw:=GetNativeFPUControlWord;
{ riscv does not support triggering exceptoins when FPU exceptions happen;
{ 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 }

View File

@ -1621,20 +1621,19 @@ end;
{$define FPC_SYSTEM_HAS_SYSRESETFPU}
Procedure SysResetFPU;
var
{ these locals are so we don't have to hack pic code in the assembler }
localmxcsr: dword;
localfpucw: word;
begin
localfpucw:=Default8087CW;
localmxcsr:=DefaultMXCSR;
asm
fninit
fwait
fldcw localfpucw
ldmxcsr localmxcsr
end;
Procedure SysResetFPU;assembler;nostackframe;
asm
fninit
fwait
{$ifdef FPC_PIC}
movq Default8087CW@GOTPCREL(%rip),%rax
fldcw (%rax)
movq DefaultMXCSR@GOTPCREL(%rip),%rax
ldmxcsr (%rax)
{$else FPC_PIC}
fldcw Default8087CW(%rip)
ldmxcsr DefaultMXCSR(%rip)
{$endif FPC_PIC}
end;