AIX FPU exception handling broken
Summary
Startup code sets XE bit in $fpscr register,
leading to exception generation as soon as a FPU operation
sets "inexact result".
See:
https://www.classe.cornell.edu/~cesrulib/documentation/totalview/html/Reference_Guides/wwhelp/wwhimpl/common/html/wwhelp.htm#href=UsingthePowerFPSCRRegister.html&single=true
System Information
- **Operating system:**AIX
- Processor architecture: powerpc and powerpc64
- **Compiler version:**3.3.1
- Device:
Steps to reproduce
Compile and run source below.
Example Project
var
d1,d2 : double;
{$if defined(VER3_3) and not defined(AIX) }
fpscr: TNativeFPUControlWord;
{$else}
fpscr : DWord;
function getFPSCR : DWord; assembler; nostackframe;
asm
mffs f0
stfd f0, -12(r1)
lwz r3, -8(r1)
end;
{$endif}
begin
{$if defined(VER3_3) and not defined(AIX)}
fpscr:=GetNativeFPUControlWord;
{$else}
fpscr:=getFPSCR;
{$endif}
writeln('fpscr=$',hexstr(qword(fpscr),2*sizeof(qword)));
d1:=1.0;
d2:=155;
d2:=d1/d2;
writeln('d2=',d2);
end.
What is the current bug behavior?
The test generates this output:
fpscr=$00000000000000F8
Runtime error 207 at $000000010000059C
What is the expected (correct) behavior?
On powerpc-linux or powerpc64-linux fpscr is set to 090, and in RTE 207 is generated. AIX code should generate the same behavior.
Relevant logs and/or screenshots
Possible fixes
code in rtl/ppcgen//ppcfpuex.inc
needs fixing.