include/fpu/softfloat: implement float16_chs helper

Backports commit 5f10aef521427b3909c24a0c7a82839b43f876e2 from qemu
This commit is contained in:
Alex Bennée 2018-03-08 10:01:01 -05:00 committed by Lioncash
parent facbc9ef66
commit 380699fa35
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -260,6 +260,14 @@ 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.
*----------------------------------------------------------------------------*/