[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/24] include/fpu/softfloat: implement float16_abs
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 05/24] include/fpu/softfloat: implement float16_abs helper |
Date: |
Sat, 3 Feb 2018 20:11:17 -0800 |
From: Alex Bennée <address@hidden>
This will be required when expanding the MINMAX() macro for 16
bit/half-precision operations.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
---
include/fpu/softfloat.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index f3b9008f78..1d34f2c3eb 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -265,6 +265,13 @@ static inline int float16_is_zero_or_denormal(float16 a)
return (float16_val(a) & 0x7c00) == 0;
}
+static inline float16 float16_abs(float16 a)
+{
+ /* Note that abs does *not* handle NaN specially, nor does
+ * it flush denormal inputs to zero.
+ */
+ return make_float16(float16_val(a) & 0x7fff);
+}
/*----------------------------------------------------------------------------
| The pattern for a default generated half-precision NaN.
*----------------------------------------------------------------------------*/
--
2.14.3
- [Qemu-devel] [PATCH 00/24] re-factor and add fp16 using glibc soft-fp, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 01/24] fpu/softfloat: implement float16_squash_input_denormal, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 02/24] include/fpu/softfloat: remove USE_SOFTFLOAT_STRUCT_TYPES, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 03/24] fpu/softfloat-types: new header to prevent excessive re-builds, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 05/24] include/fpu/softfloat: implement float16_abs helper,
Richard Henderson <=
- [Qemu-devel] [PATCH 06/24] include/fpu/softfloat: implement float16_chs helper, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 04/24] target/*/cpu.h: remove softfloat.h, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 07/24] include/fpu/softfloat: implement float16_set_sign helper, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 08/24] include/fpu/softfloat: add some float16 constants, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 11/24] fpu/soft-fp: Adjust soft-fp types, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 09/24] fpu/softfloat: improve comments on ARM NaN propagation, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 12/24] fpu/soft-fp: Add ties_away and to_odd rounding modes, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 13/24] fpu/soft-fp: Add arithmetic macros to half.h, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 14/24] fpu/soft-fp: Adjust _FP_CMP_CHECK_NAN, Richard Henderson, 2018/02/03
- [Qemu-devel] [PATCH 19/24] fpu: Implement min/max with soft-fp.h, Richard Henderson, 2018/02/03