1From 0bec1ded33a857f59cf5f3ceca2f72694256e710 Mon Sep 17 00:00:00 2001
2From: Richard Henderson <richard.henderson@linaro.org>
3Date: Fri, 17 Dec 2021 17:57:14 +0100
4Subject: [PATCH 01/21] softfloat: Extend float_exception_flags to 16 bits
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9We will shortly have more than 8 bits of exceptions.
10Repack the existing flags into low bits and reformat to hex.
11
12Upstream-Status: Backport
13[https://git.qemu.org/?p=qemu.git;a=commit;h=149a48f6e6ccedfa01307d45884aa480f5bf77c5]
14
15Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17Message-Id: <20211119160502.17432-2-richard.henderson@linaro.org>
18Signed-off-by: Cédric Le Goater <clg@kaod.org>
19Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
20---
21 include/fpu/softfloat-types.h | 16 ++++++++--------
22 include/fpu/softfloat.h       |  2 +-
23 2 files changed, 9 insertions(+), 9 deletions(-)
24
25diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
26index 5bcbd041f7..65a43aff59 100644
27--- a/include/fpu/softfloat-types.h
28+++ b/include/fpu/softfloat-types.h
29@@ -145,13 +145,13 @@ typedef enum __attribute__((__packed__)) {
30  */
31
32 enum {
33-    float_flag_invalid   =  1,
34-    float_flag_divbyzero =  4,
35-    float_flag_overflow  =  8,
36-    float_flag_underflow = 16,
37-    float_flag_inexact   = 32,
38-    float_flag_input_denormal = 64,
39-    float_flag_output_denormal = 128
40+    float_flag_invalid         = 0x0001,
41+    float_flag_divbyzero       = 0x0002,
42+    float_flag_overflow        = 0x0004,
43+    float_flag_underflow       = 0x0008,
44+    float_flag_inexact         = 0x0010,
45+    float_flag_input_denormal  = 0x0020,
46+    float_flag_output_denormal = 0x0040,
47 };
48
49 /*
50@@ -171,8 +171,8 @@ typedef enum __attribute__((__packed__)) {
51  */
52
53 typedef struct float_status {
54+    uint16_t float_exception_flags;
55     FloatRoundMode float_rounding_mode;
56-    uint8_t     float_exception_flags;
57     FloatX80RoundPrec floatx80_rounding_precision;
58     bool tininess_before_rounding;
59     /* should denormalised results go to zero and set the inexact flag? */
60diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
61index a249991e61..0d3b407807 100644
62--- a/include/fpu/softfloat.h
63+++ b/include/fpu/softfloat.h
64@@ -100,7 +100,7 @@ typedef enum {
65 | Routine to raise any or all of the software IEC/IEEE floating-point
66 | exception flags.
67 *----------------------------------------------------------------------------*/
68-static inline void float_raise(uint8_t flags, float_status *status)
69+static inline void float_raise(uint16_t flags, float_status *status)
70 {
71     status->float_exception_flags |= flags;
72 }
73--
742.17.1
75
76