IEEE754 doesn't specify precisely what NaN should be returned as the
result of an operation on two input NaNs. The existing softfloat code
hardwires x87 propagation rules. This patchset abstracts out the code
in the various propagateFloat*NaN() functions which picks a NaN to
return, so that it can be easily replaced on a per-target basis.
It also implements the correct version of this routine for ARM.

I've tested this by the usual random instruction set method. The
first patch makes no change to NaN handling (ie it is purely a
refactoring of the code); the second brings ARM into line with the
hardware implementation.
    
Maintainers of other targets should consider implementing a suitable
version of the pickNaN() function. I know the SPARC architecture
manual documents NaN rules, and they're not the x87 ones, for instance.


Peter Maydell (2):
  softfloat: abstract out target-specific NaN propagation rules
  ARM: Implement correct NaN propagation rules

 fpu/softfloat-specialize.h |  183 +++++++++++++++++++++++++++++--------------
 1 files changed, 123 insertions(+), 60 deletions(-)


Reply via email to