diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2017-12-07 19:09:24 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2018-02-21 10:20:28 +0000 |
commit | 5f10aef521427b3909c24a0c7a82839b43f876e2 (patch) | |
tree | 1f7c85d94de1ecada31c4a88311a6f78aff5b2e1 /include/fpu | |
parent | 28136775cd99c628f7d7c642b04eb87f062efef8 (diff) | |
download | qemu-5f10aef521427b3909c24a0c7a82839b43f876e2.zip qemu-5f10aef521427b3909c24a0c7a82839b43f876e2.tar.gz qemu-5f10aef521427b3909c24a0c7a82839b43f876e2.tar.bz2 |
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>
Diffstat (limited to 'include/fpu')
-rw-r--r-- | include/fpu/softfloat.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 1d34f2c..f75aa59 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -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. *----------------------------------------------------------------------------*/ |