AIX FPU exception handling broken
## Summary <!-- Summarize the bug encountered concisely --> 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 <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:**AIX <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** powerpc and powerpc64 <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:**3.3.1 <!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) --> - **Device:** <!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> ## Steps to reproduce <!-- How one can reproduce the issue - this is very important! --> Compile and run source below. ## Example Project <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. --> ``` 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? <!-- What actually happens --> The test generates this output: ``` fpscr=$00000000000000F8 Runtime error 207 at $000000010000059C ``` ## What is the expected (correct) behavior? <!-- What you should see instead --> 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 <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ## Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem --> code in `rtl/ppcgen//ppcfpuex.inc` needs fixing.
issue