[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/22] include/fpu/softfloat: implement float16_abs h
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 05/22] include/fpu/softfloat: implement float16_abs helper |
Date: |
Wed, 21 Feb 2018 11:05:05 +0000 |
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>
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.15.1
- [Qemu-devel] [PULL 00/22] re-factor softfloat and add fp16 functions, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 01/22] fpu/softfloat: implement float16_squash_input_denormal, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 03/22] fpu/softfloat-types: new header to prevent excessive re-builds, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 02/22] include/fpu/softfloat: remove USE_SOFTFLOAT_STRUCT_TYPES, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 06/22] include/fpu/softfloat: implement float16_chs helper, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 05/22] include/fpu/softfloat: implement float16_abs helper,
Alex Bennée <=
- [Qemu-devel] [PULL 07/22] include/fpu/softfloat: implement float16_set_sign helper, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 10/22] fpu/softfloat: move the extract functions to the top of the file, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 04/22] target/*/cpu.h: remove softfloat.h, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 19/22] fpu/softfloat: re-factor scalbn, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 08/22] include/fpu/softfloat: add some float16 constants, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 09/22] fpu/softfloat: improve comments on ARM NaN propagation, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 12/22] fpu/softfloat: re-factor add/sub, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 16/22] fpu/softfloat: re-factor round_to_int, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 21/22] fpu/softfloat: re-factor compare, Alex Bennée, 2018/02/21
- [Qemu-devel] [PULL 11/22] fpu/softfloat: define decompose structures, Alex Bennée, 2018/02/21