@@ -10665,6 +10665,7 @@ tests/webtbs/tw16188.pp svneol=native#text/plain
tests/webtbs/tw1622.pp svneol=native#text/plain
tests/webtbs/tw16222.pp svneol=native#text/pascal
tests/webtbs/tw1623.pp svneol=native#text/plain
+tests/webtbs/tw16263a.pp svneol=native#text/plain
tests/webtbs/tw16311.pp svneol=native#text/plain
tests/webtbs/tw16315a.pp svneol=native#text/pascal
tests/webtbs/tw16315b.pp svneol=native#text/pascal
@@ -69,7 +69,9 @@ end;
procedure fpc_cpuinit;
begin
- SysInitFPU;
+ { don't let libraries influence the FPU cw set by the host program }
+ if not IsLibrary then
+ SysInitFPU;
end;
{$ifdef wince}
@@ -110,6 +110,9 @@ procedure fpc_cpuinit;
setup_fastmove;
}
os_supports_sse:=false;
+ if IsLibrary then
+ Default8087CW:=Get8087CW;
@@ -1522,6 +1525,11 @@ procedure fpc_cpucodeinit;
sse_check:=false;
has_sse_support:=os_supports_sse;
+ if has_sse_support and
+ IsLibrary then
+ mxcsr:=GetSSECSR;
+
has_mmx_support:=mmx_support;
SysResetFPU;
if not(IsLibrary) then
@@ -43,11 +43,15 @@ procedure fpc_cpuinit;
var
tmp32: longint;
- { enable div by 0 and invalid operation fpu exceptions }
- { round towards zero; ieee compliant arithmetics }
-
- tmp32 := get_fsr();
- set_fsr((tmp32 and $fffffffc) or $00000001);
+ begin
+ { enable div by 0 and invalid operation fpu exceptions }
+ { round towards zero; ieee compliant arithmetics }
+ tmp32 := get_fsr();
+ set_fsr((tmp32 and $fffffffc) or $00000001);
+ end;
@@ -56,7 +56,9 @@ end;
- fpc_enable_ppc_fpu_exceptions;
+ fpc_enable_ppc_fpu_exceptions;
@@ -43,7 +43,9 @@ end;
{****************************************************************************
@@ -24,13 +24,6 @@
Primitives
****************************************************************************}
-procedure fpc_cpuinit;
- begin
- SysResetFPU;
- if not(IsLibrary) then
- end;
{$define FPC_SYSTEM_HAS_SPTR}
Function Sptr : Pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
asm
@@ -593,6 +586,19 @@ const
mxcsr : dword = MM_MaskUnderflow or MM_MaskPrecision or MM_MaskDenorm;
+procedure fpc_cpuinit;
+ SysResetFPU;
+ if not(IsLibrary) then
{$define FPC_SYSTEM_HAS_SYSINITFPU}
Procedure SysInitFPU;
@@ -0,0 +1,26 @@
+{ %norun }
+{ %target=darwin,linux,freebsd,solaris,beos,haiku }
+{$mode delphi}
+{$ifdef darwin}
+{$PIC+}
+{$endif darwin}
+{$ifdef CPUX86_64}
+{$ifndef WINDOWS}
+{$endif WINDOWS}
+{$endif CPUX86_64}
+library tw16263a;
+function divide(d1,d2: double): double; cdecl;
+begin
+ divide:=d1/d2;
+end;
+ // check that the library does not re-enable fpu exceptions
+ divide(1.0,0.0);
+end.