Skip to contentSkip to conversation

softfloat: Remove STATUS macros

PATCH In review Peter Maydell 2 participants 8 messages Feb 2, 2015 – Feb 6, 2015

lore
Share & tools
lore
#0 lore raw

cover softfloat: Remove STATUS macros

This patchset expands out all the uses of the softfloat STATUS_VAR, STATUS_PARAM and STATUS macros and removes their definitions.

In my opinion these macros are basically just obfuscating the passing around and use of a float_status pointer in the softfloat code, and serve no useful purpose. I used to think that we should retain them on the offchance we wanted to pull in new softfloat upstream code, but this is wrong on three counts now:
(1) there's never been any new softfloat upstream code to take
(2) even if there were, we couldn't take it because of the license
(3) these macros aren't even in the upstream version; they were added by Fabrice when he integrated softfloat into QEMU

We've never used whatever flexibility might in theory be permitted by the indirection through this set of macros, so this patchset just deletes them all.

The changes make an alarmingly large diffstat, but it's just mechanical expansion plus fixing of coding style issues on the affected lines. (Lots of style fixing because the softfloat upstream coding is (a) a long way away from QEMU's and (b) bonkers.)

This obviously is likely to induce merge conflicts with any other in-flight softfloat changes, for which I apologise in advance.

[Next on the cleanup list: get rid of those 'int8/int32/int64' types...]

Peter Maydell (3):
softfloat: Expand out the STATUS_PARAM macro
softfloat: expand out STATUS_VAR
softfloat: expand out STATUS macro

 fpu/softfloat-specialize.h |  124 ++--
 fpu/softfloat.c            | 1609 ++++++++++++++++++++++++--------------------
 include/fpu/softfloat.h    |  371 +++++-----
 target-mips/msa_helper.c   |   74 +-
 4 files changed, 1188 insertions(+), 990 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 softfloat: Expand out the STATUS_PARAM macro

Expand out STATUS_PARAM wherever it is used and delete the definition.

---
 fpu/softfloat-specialize.h |  50 +++---
 fpu/softfloat.c            | 387 ++++++++++++++++++++++++---------------------
 include/fpu/softfloat.h    | 332 +++++++++++++++++++-------------------
 target-mips/msa_helper.c   |  18 ++-
 4 files changed, 410 insertions(+), 377 deletions(-)
fpu/softfloat-specialize.h +29 -21
index 23d7378..264f6c0 100644
@@ -170,7 +170,7 @@ const float128 float128_default_nan
 | should be simply `float_exception_flags |= flags;'.
 *----------------------------------------------------------------------------*/
 
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise(int8 flags , float_status *status)
 {
     STATUS(float_exception_flags) |= flags;
 }
@@ -253,7 +253,7 @@ float16 float16_maybe_silence_nan(float16 a_)
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float16ToCommonNaN( float16 a STATUS_PARAM )
+static commonNaNT float16ToCommonNaN(float16 a, float_status *status)
 {
     commonNaNT z;
 
@@ -269,7 +269,7 @@ static commonNaNT float16ToCommonNaN( float16 a STATUS_PARAM )
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float16 commonNaNToFloat16(commonNaNT a STATUS_PARAM)
+static float16 commonNaNToFloat16(commonNaNT a, float_status *status)
 {
     uint16_t mantissa = a.high>>54;
 
@@ -356,7 +356,7 @@ float32 float32_maybe_silence_nan( float32 a_ )
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float32ToCommonNaN( float32 a STATUS_PARAM )
+static commonNaNT float32ToCommonNaN(float32 a, float_status *status)
 {
     commonNaNT z;
 
@@ -372,7 +372,7 @@ static commonNaNT float32ToCommonNaN( float32 a STATUS_PARAM )
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float32 commonNaNToFloat32( commonNaNT a STATUS_PARAM)
+static float32 commonNaNToFloat32(commonNaNT a, float_status *status)
 {
     uint32_t mantissa = a.high>>41;
 
@@ -507,7 +507,8 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 *----------------------------------------------------------------------------*/
 #if defined(TARGET_ARM)
 static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+                         flag cIsQNaN, flag cIsSNaN, flag infzero,
+                         float_status *status)
 {
     /* For ARM, the (inf,zero,qnan) case sets InvalidOp and returns
      * the default NaN
@@ -536,7 +537,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 }
 #elif defined(TARGET_MIPS)
 static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+                         flag cIsQNaN, flag cIsSNaN, flag infzero,
+                         float_status *status)
 {
     /* For MIPS, the (inf,zero,qnan) case sets InvalidOp and returns
      * the default NaN
@@ -563,7 +565,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 }
 #elif defined(TARGET_PPC)
 static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+                         flag cIsQNaN, flag cIsSNaN, flag infzero,
+                         float_status *status)
 {
     /* For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
      * to return an input NaN if we have one (ie c) rather than generating
@@ -590,7 +593,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
  * This is unlikely to actually match any real implementation.
  */
 static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+                         flag cIsQNaN, flag cIsSNaN, flag infzero,
+                         float_status *status)
 {
     if (aIsSNaN || aIsQNaN) {
         return 0;
@@ -608,7 +612,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 | signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
+static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
     flag aIsLargerSignificand;
@@ -652,7 +656,8 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static float32 propagateFloat32MulAddNaN(float32 a, float32 b,
-                                         float32 c, flag infzero STATUS_PARAM)
+                                         float32 c, flag infzero,
+                                         float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
         cIsQuietNaN, cIsSignalingNaN;
@@ -767,7 +772,7 @@ float64 float64_maybe_silence_nan( float64 a_ )
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float64ToCommonNaN( float64 a STATUS_PARAM)
+static commonNaNT float64ToCommonNaN(float64 a, float_status *status)
 {
     commonNaNT z;
 
@@ -783,7 +788,7 @@ static commonNaNT float64ToCommonNaN( float64 a STATUS_PARAM)
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float64 commonNaNToFloat64( commonNaNT a STATUS_PARAM)
+static float64 commonNaNToFloat64(commonNaNT a, float_status *status)
 {
     uint64_t mantissa = a.high>>12;
 
@@ -806,7 +811,7 @@ static float64 commonNaNToFloat64( commonNaNT a STATUS_PARAM)
 | signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM)
+static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
     flag aIsLargerSignificand;
@@ -850,7 +855,8 @@ static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static float64 propagateFloat64MulAddNaN(float64 a, float64 b,
-                                         float64 c, flag infzero STATUS_PARAM)
+                                         float64 c, flag infzero,
+                                         float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
         cIsQuietNaN, cIsSignalingNaN;
@@ -975,7 +981,7 @@ floatx80 floatx80_maybe_silence_nan( floatx80 a )
 | invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT floatx80ToCommonNaN( floatx80 a STATUS_PARAM)
+static commonNaNT floatx80ToCommonNaN(floatx80 a, float_status *status)
 {
     commonNaNT z;
 
@@ -997,7 +1003,7 @@ static commonNaNT floatx80ToCommonNaN( floatx80 a STATUS_PARAM)
 | double-precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static floatx80 commonNaNToFloatx80( commonNaNT a STATUS_PARAM)
+static floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status)
 {
     floatx80 z;
 
@@ -1024,7 +1030,8 @@ static floatx80 commonNaNToFloatx80( commonNaNT a STATUS_PARAM)
 | `b' is a signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b STATUS_PARAM)
+static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b,
+                                     float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
     flag aIsLargerSignificand;
@@ -1134,7 +1141,7 @@ float128 float128_maybe_silence_nan( float128 a )
 | exception is raised.
 *----------------------------------------------------------------------------*/
 
-static commonNaNT float128ToCommonNaN( float128 a STATUS_PARAM)
+static commonNaNT float128ToCommonNaN(float128 a, float_status *status)
 {
     commonNaNT z;
 
@@ -1149,7 +1156,7 @@ static commonNaNT float128ToCommonNaN( float128 a STATUS_PARAM)
 | precision floating-point format.
 *----------------------------------------------------------------------------*/
 
-static float128 commonNaNToFloat128( commonNaNT a STATUS_PARAM)
+static float128 commonNaNToFloat128(commonNaNT a, float_status *status)
 {
     float128 z;
 
@@ -1170,7 +1177,8 @@ static float128 commonNaNToFloat128( commonNaNT a STATUS_PARAM)
 | `b' is a signaling NaN, the invalid exception is raised.
 *----------------------------------------------------------------------------*/
 
-static float128 propagateFloat128NaN( float128 a, float128 b STATUS_PARAM)
+static float128 propagateFloat128NaN(float128 a, float128 b,
+                                     float_status *status)
 {
     flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
     flag aIsLargerSignificand;
fpu/softfloat.c +205 -182

1,379 lines not on this page · raw message

include/fpu/softfloat.h +166 -166

451 lines not on this page · raw message

target-mips/msa_helper.c +10 -8
index 6e07f6e..c9fc9f9 100644
@@ -1614,7 +1614,8 @@ static inline int get_enabled_exceptions(const CPUMIPSState *env, int c)
     return c & enable;
 }
 
-static inline float16 float16_from_float32(int32 a, flag ieee STATUS_PARAM)
+static inline float16 float16_from_float32(int32 a, flag ieee,
+                                           float_status *status)
 {
       float16 f_val;
 
@@ -1624,7 +1625,7 @@ static inline float16 float16_from_float32(int32 a, flag ieee STATUS_PARAM)
       return a < 0 ? (f_val | (1 << 15)) : f_val;
 }
 
-static inline float32 float32_from_float64(int64 a STATUS_PARAM)
+static inline float32 float32_from_float64(int64 a, float_status *status)
 {
       float32 f_val;
 
@@ -1634,7 +1635,8 @@ static inline float32 float32_from_float64(int64 a STATUS_PARAM)
       return a < 0 ? (f_val | (1 << 31)) : f_val;
 }
 
-static inline float32 float32_from_float16(int16_t a, flag ieee STATUS_PARAM)
+static inline float32 float32_from_float16(int16_t a, flag ieee,
+                                           float_status *status)
 {
       float32 f_val;
 
@@ -1644,7 +1646,7 @@ static inline float32 float32_from_float16(int16_t a, flag ieee STATUS_PARAM)
       return a < 0 ? (f_val | (1 << 31)) : f_val;
 }
 
-static inline float64 float64_from_float32(int32 a STATUS_PARAM)
+static inline float64 float64_from_float32(int32 a, float_status *status)
 {
       float64 f_val;
 
@@ -1654,7 +1656,7 @@ static inline float64 float64_from_float32(int32 a STATUS_PARAM)
       return a < 0 ? (f_val | (1ULL << 63)) : f_val;
 }
 
-static inline float32 float32_from_q16(int16_t a STATUS_PARAM)
+static inline float32 float32_from_q16(int16_t a, float_status *status)
 {
     float32 f_val;
 
@@ -1665,7 +1667,7 @@ static inline float32 float32_from_q16(int16_t a STATUS_PARAM)
     return f_val;
 }
 
-static inline float64 float64_from_q32(int32 a STATUS_PARAM)
+static inline float64 float64_from_q32(int32 a, float_status *status)
 {
     float64 f_val;
 
@@ -1676,7 +1678,7 @@ static inline float64 float64_from_q32(int32 a STATUS_PARAM)
     return f_val;
 }
 
-static inline int16_t float32_to_q16(float32 a STATUS_PARAM)
+static inline int16_t float32_to_q16(float32 a, float_status *status)
 {
     int32 q_val;
     int32 q_min = 0xffff8000;
@@ -1728,7 +1730,7 @@ static inline int16_t float32_to_q16(float32 a STATUS_PARAM)
     return (int16_t)q_val;
 }
 
-static inline int32 float64_to_q32(float64 a STATUS_PARAM)
+static inline int32 float64_to_q32(float64 a, float_status *status)
 {
     int64 q_val;
     int64 q_min = 0xffffffff80000000LL;
Signature · 1 line
1.9.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] softfloat: Expand out the STATUS_PARAM macro

fpu/softfloat-specialize.h const float128 float128_default_nan · line 173

Quoted 2 lines · Peter Maydell
fpu/softfloat-specialize.h +1 -1
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise(int8 flags , float_status *status)

Extra space before comma.

r~

#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] softfloat: Expand out the STATUS_PARAM macro

Quoted 5 lines · Richard Henderson

fpu/softfloat-specialize.h const float128 float128_default_nan · line 173

Quoted 2 lines · Peter Maydell
fpu/softfloat-specialize.h +1 -1
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise(int8 flags , float_status *status)

Extra space before comma.

Thanks, fixed. I don't propose to send out a respin just for that.

-- PMM

#4 lore raw

PATCH 2/3 softfloat: expand out STATUS_VAR

In reply to Peter Maydell

Expand out and remove the STATUS_VAR macro.

---
 fpu/softfloat-specialize.h |  50 ++-
 fpu/softfloat.c            | 995 +++++++++++++++++++++++++--------------------
 include/fpu/softfloat.h    |   9 +-
 target-mips/msa_helper.c   |  56 +--
 4 files changed, 617 insertions(+), 493 deletions(-)
fpu/softfloat-specialize.h +34 -16
index 264f6c0..21d3ec2 100644
@@ -257,7 +257,9 @@ static commonNaNT float16ToCommonNaN(float16 a, float_status *status)
 {
     commonNaNT z;
 
-    if ( float16_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR );
+    if (float16_is_signaling_nan(a)) {
+        float_raise(float_flag_invalid, status);
+    }
     z.sign = float16_val(a) >> 15;
     z.low = 0;
     z.high = ((uint64_t) float16_val(a))<<54;
@@ -360,7 +362,9 @@ static commonNaNT float32ToCommonNaN(float32 a, float_status *status)
 {
     commonNaNT z;
 
-    if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR );
+    if (float32_is_signaling_nan(a)) {
+        float_raise(float_flag_invalid, status);
+    }
     z.sign = float32_val(a)>>31;
     z.low = 0;
     z.high = ( (uint64_t) float32_val(a) )<<41;
@@ -514,7 +518,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
      * the default NaN
      */
     if (infzero && cIsQNaN) {
-        float_raise(float_flag_invalid STATUS_VAR);
+        float_raise(float_flag_invalid, status);
         return 3;
     }
 
@@ -544,7 +548,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
      * the default NaN
      */
     if (infzero) {
-        float_raise(float_flag_invalid STATUS_VAR);
+        float_raise(float_flag_invalid, status);
         return 3;
     }
 
@@ -573,7 +577,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
      * a default NaN
      */
     if (infzero) {
-        float_raise(float_flag_invalid STATUS_VAR);
+        float_raise(float_flag_invalid, status);
         return 2;
     }
 
@@ -625,7 +629,9 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)
     av = float32_val(a);
     bv = float32_val(b);
 
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR);
+    if (aIsSignalingNaN | bIsSignalingNaN) {
+        float_raise(float_flag_invalid, status);
+    }
 
     if ( STATUS(default_nan_mode) )
         return float32_default_nan;
@@ -671,12 +677,12 @@ static float32 propagateFloat32MulAddNaN(float32 a, float32 b,
     cIsSignalingNaN = float32_is_signaling_nan(c);
 
     if (aIsSignalingNaN | bIsSignalingNaN | cIsSignalingNaN) {
-        float_raise(float_flag_invalid STATUS_VAR);
+        float_raise(float_flag_invalid, status);
     }
 
     which = pickNaNMulAdd(aIsQuietNaN, aIsSignalingNaN,
                           bIsQuietNaN, bIsSignalingNaN,
-                          cIsQuietNaN, cIsSignalingNaN, infzero STATUS_VAR);
+                          cIsQuietNaN, cIsSignalingNaN, infzero, status);
 
     if (STATUS(default_nan_mode)) {
         /* Note that this check is after pickNaNMulAdd so that function
@@ -776,7 +782,9 @@ static commonNaNT float64ToCommonNaN(float64 a, float_status *status)
 {
     commonNaNT z;
 
-    if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR);
+    if (float64_is_signaling_nan(a)) {
+        float_raise(float_flag_invalid, status);
+    }
     z.sign = float64_val(a)>>63;
     z.low = 0;
     z.high = float64_val(a)<<12;
@@ -824,7 +832,9 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status)
     av = float64_val(a);
     bv = float64_val(b);
 
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR);
+    if (aIsSignalingNaN | bIsSignalingNaN) {
+        float_raise(float_flag_invalid, status);
+    }
 
     if ( STATUS(default_nan_mode) )
         return float64_default_nan;
@@ -870,12 +880,12 @@ static float64 propagateFloat64MulAddNaN(float64 a, float64 b,
     cIsSignalingNaN = float64_is_signaling_nan(c);
 
     if (aIsSignalingNaN | bIsSignalingNaN | cIsSignalingNaN) {
-        float_raise(float_flag_invalid STATUS_VAR);
+        float_raise(float_flag_invalid, status);
     }
 
     which = pickNaNMulAdd(aIsQuietNaN, aIsSignalingNaN,
                           bIsQuietNaN, bIsSignalingNaN,
-                          cIsQuietNaN, cIsSignalingNaN, infzero STATUS_VAR);
+                          cIsQuietNaN, cIsSignalingNaN, infzero, status);
 
     if (STATUS(default_nan_mode)) {
         /* Note that this check is after pickNaNMulAdd so that function
@@ -985,7 +995,9 @@ static commonNaNT floatx80ToCommonNaN(floatx80 a, float_status *status)
 {
     commonNaNT z;
 
-    if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR);
+    if (floatx80_is_signaling_nan(a)) {
+        float_raise(float_flag_invalid, status);
+    }
     if ( a.low >> 63 ) {
         z.sign = a.high >> 15;
         z.low = 0;
@@ -1041,7 +1053,9 @@ static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b,
     bIsQuietNaN = floatx80_is_quiet_nan( b );
     bIsSignalingNaN = floatx80_is_signaling_nan( b );
 
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR);
+    if (aIsSignalingNaN | bIsSignalingNaN) {
+        float_raise(float_flag_invalid, status);
+    }
 
     if ( STATUS(default_nan_mode) ) {
         a.low = floatx80_default_nan_low;
@@ -1145,7 +1159,9 @@ static commonNaNT float128ToCommonNaN(float128 a, float_status *status)
 {
     commonNaNT z;
 
-    if ( float128_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR);
+    if (float128_is_signaling_nan(a)) {
+        float_raise(float_flag_invalid, status);
+    }
     z.sign = a.high>>63;
     shortShift128Left( a.high, a.low, 16, &z.high, &z.low );
     return z;
@@ -1188,7 +1204,9 @@ static float128 propagateFloat128NaN(float128 a, float128 b,
     bIsQuietNaN = float128_is_quiet_nan( b );
     bIsSignalingNaN = float128_is_signaling_nan( b );
 
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR);
+    if (aIsSignalingNaN | bIsSignalingNaN) {
+        float_raise(float_flag_invalid, status);
+    }
 
     if ( STATUS(default_nan_mode) ) {
         a.low = float128_default_nan_low;
fpu/softfloat.c +551 -444

2,858 lines not on this page · raw message

include/fpu/softfloat.h +4 -5
index fab2aee..d13fd0e 100644

Lines of this file are not shown. View the raw message.

target-mips/msa_helper.c +28 -28

56 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.9.1

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH 3/3 softfloat: expand out STATUS macro

In reply to Peter Maydell

Expand out and remove the STATUS macro.

---
 fpu/softfloat-specialize.h |  24 ++---
 fpu/softfloat.c            | 239 ++++++++++++++++++++++++++-------------------
 include/fpu/softfloat.h    |  30 +++---
 3 files changed, 167 insertions(+), 126 deletions(-)
fpu/softfloat-specialize.h +12 -12
index 21d3ec2..b5b4c67 100644
@@ -172,7 +172,7 @@ const float128 float128_default_nan
 
 void float_raise(int8 flags , float_status *status)
 {
-    STATUS(float_exception_flags) |= flags;
+    status->float_exception_flags |= flags;
 }
 
 /*----------------------------------------------------------------------------
@@ -275,7 +275,7 @@ static float16 commonNaNToFloat16(commonNaNT a, float_status *status)
 {
     uint16_t mantissa = a.high>>54;
 
-    if (STATUS(default_nan_mode)) {
+    if (status->default_nan_mode) {
         return float16_default_nan;
     }
 
@@ -380,7 +380,7 @@ static float32 commonNaNToFloat32(commonNaNT a, float_status *status)
 {
     uint32_t mantissa = a.high>>41;
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         return float32_default_nan;
     }
 
@@ -633,7 +633,7 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)
         float_raise(float_flag_invalid, status);
     }
 
-    if ( STATUS(default_nan_mode) )
+    if (status->default_nan_mode)
         return float32_default_nan;
 
     if ((uint32_t)(av<<1) < (uint32_t)(bv<<1)) {
@@ -684,7 +684,7 @@ static float32 propagateFloat32MulAddNaN(float32 a, float32 b,
                           bIsQuietNaN, bIsSignalingNaN,
                           cIsQuietNaN, cIsSignalingNaN, infzero, status);
 
-    if (STATUS(default_nan_mode)) {
+    if (status->default_nan_mode) {
         /* Note that this check is after pickNaNMulAdd so that function
          * has an opportunity to set the Invalid flag.
          */
@@ -800,7 +800,7 @@ static float64 commonNaNToFloat64(commonNaNT a, float_status *status)
 {
     uint64_t mantissa = a.high>>12;
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         return float64_default_nan;
     }
 
@@ -836,7 +836,7 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status)
         float_raise(float_flag_invalid, status);
     }
 
-    if ( STATUS(default_nan_mode) )
+    if (status->default_nan_mode)
         return float64_default_nan;
 
     if ((uint64_t)(av<<1) < (uint64_t)(bv<<1)) {
@@ -887,7 +887,7 @@ static float64 propagateFloat64MulAddNaN(float64 a, float64 b,
                           bIsQuietNaN, bIsSignalingNaN,
                           cIsQuietNaN, cIsSignalingNaN, infzero, status);
 
-    if (STATUS(default_nan_mode)) {
+    if (status->default_nan_mode) {
         /* Note that this check is after pickNaNMulAdd so that function
          * has an opportunity to set the Invalid flag.
          */
@@ -1019,7 +1019,7 @@ static floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status)
 {
     floatx80 z;
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         z.low = floatx80_default_nan_low;
         z.high = floatx80_default_nan_high;
         return z;
@@ -1057,7 +1057,7 @@ static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b,
         float_raise(float_flag_invalid, status);
     }
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         a.low = floatx80_default_nan_low;
         a.high = floatx80_default_nan_high;
         return a;
@@ -1176,7 +1176,7 @@ static float128 commonNaNToFloat128(commonNaNT a, float_status *status)
 {
     float128 z;
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         z.low = float128_default_nan_low;
         z.high = float128_default_nan_high;
         return z;
@@ -1208,7 +1208,7 @@ static float128 propagateFloat128NaN(float128 a, float128 b,
         float_raise(float_flag_invalid, status);
     }
 
-    if ( STATUS(default_nan_mode) ) {
+    if (status->default_nan_mode) {
         a.low = float128_default_nan_low;
         a.high = float128_default_nan_high;
         return a;
fpu/softfloat.c +141 -98

752 lines not on this page · raw message

include/fpu/softfloat.h +14 -16
index d13fd0e..ded34eb 100644
@@ -108,8 +108,6 @@ typedef int64_t int64;
 
 #define LIT64( a ) a##LL
 
-#define STATUS(field) status->field
-
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE floating-point ordering relations
 *----------------------------------------------------------------------------*/
@@ -224,60 +222,60 @@ typedef struct float_status {
 
 static inline void set_float_detect_tininess(int val, float_status *status)
 {
-    STATUS(float_detect_tininess) = val;
+    status->float_detect_tininess = val;
 }
 static inline void set_float_rounding_mode(int val, float_status *status)
 {
-    STATUS(float_rounding_mode) = val;
+    status->float_rounding_mode = val;
 }
 static inline void set_float_exception_flags(int val, float_status *status)
 {
-    STATUS(float_exception_flags) = val;
+    status->float_exception_flags = val;
 }
 static inline void set_floatx80_rounding_precision(int val,
                                                    float_status *status)
 {
-    STATUS(floatx80_rounding_precision) = val;
+    status->floatx80_rounding_precision = val;
 }
 static inline void set_flush_to_zero(flag val, float_status *status)
 {
-    STATUS(flush_to_zero) = val;
+    status->flush_to_zero = val;
 }
 static inline void set_flush_inputs_to_zero(flag val, float_status *status)
 {
-    STATUS(flush_inputs_to_zero) = val;
+    status->flush_inputs_to_zero = val;
 }
 static inline void set_default_nan_mode(flag val, float_status *status)
 {
-    STATUS(default_nan_mode) = val;
+    status->default_nan_mode = val;
 }
 static inline int get_float_detect_tininess(float_status *status)
 {
-    return STATUS(float_detect_tininess);
+    return status->float_detect_tininess;
 }
 static inline int get_float_rounding_mode(float_status *status)
 {
-    return STATUS(float_rounding_mode);
+    return status->float_rounding_mode;
 }
 static inline int get_float_exception_flags(float_status *status)
 {
-    return STATUS(float_exception_flags);
+    return status->float_exception_flags;
 }
 static inline int get_floatx80_rounding_precision(float_status *status)
 {
-    return STATUS(floatx80_rounding_precision);
+    return status->floatx80_rounding_precision;
 }
 static inline flag get_flush_to_zero(float_status *status)
 {
-    return STATUS(flush_to_zero);
+    return status->flush_to_zero;
 }
 static inline flag get_flush_inputs_to_zero(float_status *status)
 {
-    return STATUS(flush_inputs_to_zero);
+    return status->flush_inputs_to_zero;
 }
 static inline flag get_default_nan_mode(float_status *status)
 {
-    return STATUS(default_nan_mode);
+    return status->default_nan_mode;
 }
 
 /*----------------------------------------------------------------------------
Signature · 1 line
1.9.1
Reviewed-by on the v1 series
#6 lore raw
In reply to Peter Maydell
Quoted 10 lines · Peter Maydell

Peter Maydell (3):
softfloat: Expand out the STATUS_PARAM macro
softfloat: expand out STATUS_VAR
softfloat: expand out STATUS macro

 fpu/softfloat-specialize.h |  124 ++--
 fpu/softfloat.c            | 1609 ++++++++++++++++++++++++--------------------
 include/fpu/softfloat.h    |  371 +++++-----
 target-mips/msa_helper.c   |   74 +-
 4 files changed, 1188 insertions(+), 990 deletions(-)

r~

#7 lore raw
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Peter Maydell

Peter Maydell (3):
softfloat: Expand out the STATUS_PARAM macro
softfloat: expand out STATUS_VAR
softfloat: expand out STATUS macro

Quoted 7 lines
Quoted 5 lines
 fpu/softfloat-specialize.h |  124 ++--
 fpu/softfloat.c            | 1609 ++++++++++++++++++++++++--------------------
 include/fpu/softfloat.h    |  371 +++++-----
 target-mips/msa_helper.c   |   74 +-
 4 files changed, 1188 insertions(+), 990 deletions(-)

Thanks. Unless anybody wants to object I think I'll apply these to master today (with the removal of the space you point out in patch 1), since they're kind of disruptive and I think that will overall minimise peoples' rebasing pain.

-- PMM