Message ID | 20180109122252.17670-5-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | re-factor softfloat and add fp16 functions | expand |
On 9 January 2018 at 12:22, Alex Bennée <alex.bennee@linaro.org> wrote: > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/fpu/softfloat.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h > index cfc615008d..dc71b01dba 100644 > --- a/include/fpu/softfloat.h > +++ b/include/fpu/softfloat.h > @@ -354,6 +354,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); > +} > + Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index cfc615008d..dc71b01dba 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -354,6 +354,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. *----------------------------------------------------------------------------*/