include/fpu/softfloat: implement float16_chs helper

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Alex Bennée 2017-12-07 19:09:24 +00:00
parent 28136775cd
commit 5f10aef521
1 changed files with 9 additions and 0 deletions

View File

@ -272,6 +272,15 @@ static inline float16 float16_abs(float16 a)
*/
return make_float16(float16_val(a) & 0x7fff);
}
static inline float16 float16_chs(float16 a)
{
/* Note that chs does *not* handle NaN specially, nor does
* it flush denormal inputs to zero.
*/
return make_float16(float16_val(a) ^ 0x8000);
}
/*----------------------------------------------------------------------------
| The pattern for a default generated half-precision NaN.
*----------------------------------------------------------------------------*/