mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-11 10:58:23 +02:00
* Add fpu_XXX constants and use them for fpc_cpuinit procedure
git-svn-id: trunk@21712 -
This commit is contained in:
parent
3a082f8c29
commit
ba4122fda8
@ -37,6 +37,24 @@ function get_got_z : pointer;assembler;nostackframe;[public, alias: 'FPC_GETGOT_
|
||||
move $2,$28
|
||||
end;
|
||||
|
||||
const
|
||||
{ FPU enable exception bits for FCSR register }
|
||||
fpu_enable_inexact = $80;
|
||||
fpu_enable_underflow = $100;
|
||||
fpu_enable_overflow = $200;
|
||||
fpu_enable_div_zero = $400;
|
||||
fpu_enable_invalid = $800;
|
||||
fpu_enable_mask = $F80;
|
||||
default_fpu_enable = fpu_enable_div_zero or fpu_enable_invalid;
|
||||
|
||||
fpu_flags_mask = $7C;
|
||||
{ FPU rounding mask and values }
|
||||
fpu_rounding_mask = $3;
|
||||
fpu_rounding_nearest = 0;
|
||||
fpu_rounding_towards_zero = 1;
|
||||
fpu_rounding_plus_inf = 2;
|
||||
fpu_rounding_minus_inf = 3;
|
||||
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
var
|
||||
@ -45,11 +63,17 @@ var
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if not IsLibrary then
|
||||
begin
|
||||
{ enable div by 0 and invalid operation fpu exceptions }
|
||||
{ round towards nearest; ieee compliant arithmetics }
|
||||
|
||||
tmp32 := get_fsr();
|
||||
set_fsr(tmp32 and $fffffffc);
|
||||
{ enable div by 0 and invalid operation fpu exceptions,
|
||||
disable the other exceptions }
|
||||
tmp32 := (tmp32 and not fpu_enable_mask) or default_fpu_enable;
|
||||
{ Reset flags }
|
||||
tmp32 := tmp32 and not fpu_flags_mask;
|
||||
|
||||
{ round towards nearest; ieee compliant arithmetics }
|
||||
tmp32 := (tmp32 and not fpu_rounding_mask) or fpu_rounding_nearest;
|
||||
|
||||
set_fsr(tmp32);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user