80-bit floating-point math on ppc64le
From this comment by @ptitSeb :
SSE/SSE2 instruction are converted t the underling SIMD instruction. Same for x87 that are converted to Float and Double operation (ignoring 80bits operation for most part).
According to @awilfox :
There is quad-float support in hardware with ISA 3.0 (Power9).
It might be interesting to support 80-bit x87 math on POWER9 via quad-precision floating-point math, for a speed-up when the default BOX64_X87_NO80BITS=0 is used.
My understanding is that quad float is only hardware-accelerated in POWER9 and higher (so POWER8LE users would need to disable it), and is only aliased to long double on a subset of distros (e.g. recent Fedora, grep Talospace for articles that mention "long double").
It looks to me like the GCC options you want are -mfloat128 -mfloat128-hardware, and then use the __float128 data type instead of long double so that it works as expected on older distros.
CC: @classilla
converting 80bits to 128bits long double is, for now, not supported. It can be done in theory. The main issue would be to conversion 80btis to/from 128bits that needs to be written. Once this is exist, a new HAVE_128BITS can be added to the code to handle that.
Note that it is seldom used, and all internal computation will still be done in 64bits, so not sure it's worth the effort.
Some examples of games and software utilizing the 80-bit precision:
- https://github.com/dosbox-staging/dosbox-staging/issues/2900#issuecomment-1740280812
- https://github.com/dosbox-staging/dosbox-staging/issues/3125
- civil engineering calculations
RISC-V Q/L and IBM z also support 128-bit precision in hardware.
Some examples of games and software utilizing the 80-bit precision:
- Frontier: First Encounters (1995) crashes on non-x86 platforms dosbox-staging/dosbox-staging#2900 (comment)
- Allow extended precision floating point calculations to be done in software dosbox-staging/dosbox-staging#3125
- civil engineering calculations
RISC-V Q/L and IBM z also support 128-bit precision in hardware.
Those are all DOS program. Point is, on windows & linux, there is very little use of actual x87 80bits precisions. And on DOS era, it was many use as a trick to move 64bits values (wich box64/box86 support) or use to blit memory with 80bits values at a time (rarely used, but I remember seeing that 1 time, I think it was with carmaggedon). It's even more rare on 64bits program, as SSE2 is mandatory and used instead of x87 for most float computations.
Is box86 also targeting older Windows games/software (for XP, 9x, 3.x, etc.)? x87 was deprecated only in 64-bit Windows, so I would expect at least some of the Windows programs to utilize 80-bit precision.
Yes, box86 target older windows games. Still there are very few games that needs 80bits precision.