On Sun, 4 Jun 2017, James Hogan wrote: > >The ultimate target for this is > >Loongson 2F which probably uses the old encoding. > > indeed. i think nan2008 is optional in r5, required in r6. Support for 2008 NaN has been first added to R3 with run-time selection between the legacy-NaN and the 2008-NaN encoding allowed, but not mandated by the architecture. No actual hardware has implemented this selection, so in reality all R3 hardware is hardwired to either legacy NaN or 2008 NaN. The kernel emulator does implement the run-time selection though, as specified by the architecture, which is why with the `nofpu' kernel parameter or on non-FPU hardware you can run both legacy-NaN and 2008-NaN user software. To make people's lives easier the run-time selection is allowed regardless of the architecture level implemented by the CPU (although for legacy hardware only with `ieee754=relaxed'). I can't speak for QEMU -- the patches I made a while ago and submitted upstream did provide for run-time selection, on a per emulated CPU basis, but then someone else took over that effort and reimplemented the feature, and I have no idea how much of the original work has been preserved. In R5 the architecture mandates the NaN setting to be hardwired, and 2008-NaN support is required if the MSA module has been implemented, or otherwise implementing either legacy NaN or 2008 NaN is allowed, but no run-time selection. In R6 the architecture indeed mandates the NaN setting to be hardwired to 2008. In all architecture revisions the current NaN setting and the ability to change it can be determined at run time by software, which can then adapt accordingly. Maciej