mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 12:49:19 +02:00
+ function needs_check_for_fpu_exceptions to unify fpu exception handling
This commit is contained in:
parent
629c87efc8
commit
a71cc71585
@ -493,7 +493,7 @@ interface
|
||||
if Result=nil then
|
||||
begin
|
||||
if left.resultdef.typ=floatdef then
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
end;
|
||||
|
@ -85,7 +85,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -94,7 +94,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -103,7 +103,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -112,7 +112,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -121,7 +121,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -130,7 +130,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -139,7 +139,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
@ -371,7 +371,7 @@ implementation
|
||||
begin
|
||||
expectloc:=LOC_MMREGISTER;
|
||||
Result:=nil;
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end
|
||||
else if is_32bitint(resultdef) then
|
||||
|
@ -487,7 +487,7 @@ implementation
|
||||
begin
|
||||
Result:=inherited pass_1;
|
||||
if Result=nil then
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
Include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
|
@ -1780,9 +1780,8 @@ unit cgcpu;
|
||||
ai: taicpu;
|
||||
l: TAsmLabel;
|
||||
begin
|
||||
if ((cs_check_fpu_exceptions in current_settings.localswitches) and
|
||||
not(FPUARM_HAS_EXCEPTION_TRAPPING in fpu_capabilities[current_settings.fputype]) and
|
||||
(force or current_procinfo.FPUExceptionCheckNeeded)) then
|
||||
if needs_check_for_fpu_exceptions and
|
||||
(force or current_procinfo.FPUExceptionCheckNeeded) then
|
||||
begin
|
||||
r:=getintregister(list,OS_INT);
|
||||
list.concat(taicpu.op_reg_reg(A_FMRX,r,NR_FPSCR));
|
||||
|
@ -224,11 +224,17 @@ unit cgutils;
|
||||
WARNING: d must not be a power of 2 (including 2^0 = 1) }
|
||||
procedure calc_mul_inverse(N: byte; d: aWord; out reciprocal: aWord; out shift: Byte);
|
||||
|
||||
{ returns true if the CPU architecture we are currently compiling for needs
|
||||
software checks for fpu exceptions }
|
||||
function needs_check_for_fpu_exceptions : boolean;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
systems,
|
||||
verbose,
|
||||
globals,
|
||||
cpuinfo,
|
||||
cgobj;
|
||||
|
||||
{****************************************************************************
|
||||
@ -570,6 +576,24 @@ uses
|
||||
reciprocal:=swap_r;
|
||||
until d<=1;
|
||||
end;
|
||||
|
||||
|
||||
function needs_check_for_fpu_exceptions: boolean;
|
||||
begin
|
||||
{$if defined(AARCH64)}
|
||||
result:=cs_check_fpu_exceptions in current_settings.localswitches;
|
||||
{$elseif defined(ARM)}
|
||||
result:=(cs_check_fpu_exceptions in current_settings.localswitches) and
|
||||
not(FPUARM_HAS_EXCEPTION_TRAPPING in fpu_capabilities[current_settings.fputype]);
|
||||
{$elseif defined(RISCV)}
|
||||
result:=cs_check_fpu_exceptions in current_settings.localswitches;
|
||||
{$elseif defined(XTENSA)}
|
||||
result:=cs_check_fpu_exceptions in current_settings.localswitches;
|
||||
{$else}
|
||||
result:=false;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{$pop}
|
||||
|
||||
end.
|
||||
|
@ -1040,7 +1040,7 @@ unit cgrv;
|
||||
ai: taicpu;
|
||||
l: TAsmLabel;
|
||||
begin
|
||||
if cs_check_fpu_exceptions in current_settings.localswitches then
|
||||
if needs_check_for_fpu_exceptions then
|
||||
begin
|
||||
r:=getintregister(list,OS_INT);
|
||||
list.concat(taicpu.op_reg(A_FRFLAGS,r));
|
||||
|
Loading…
Reference in New Issue
Block a user