• P
    softfloat: Fix exception flag handling for float32_to_float16() · 38970efa
    Peter Maydell 提交于
    Our float32 to float16 conversion routine was generating the correct
    numerical answers, but not always setting the right set of exception
    flags. Fix this, mostly by rearranging the code to more closely
    resemble RoundAndPackFloat*, and in particular:
     * non-IEEE halfprec always raises Invalid for input NaNs
     * we need to check for the overflow case before underflow
     * we weren't getting the tininess-detected-after-rounding
       case correct (somewhat academic since only ARM uses halfprec
       and it is always tininess-detected-before-rounding)
     * non-IEEE halfprec overflow raises only Invalid, not
       Invalid + Inexact
     * we weren't setting Inexact when we should
    
    Also add some clarifying comments about what the code is doing.
    Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: NRichard Henderson <rth@twiddle.net>
    38970efa
softfloat.c 246.7 KB