Skip to contentSkip to conversation

softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile

PATCH In review Juan Quintela 3 participants 5 messages Mar 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile

This change makes it compile and return the same value than the #undef one.

---
 fpu/softfloat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fpu/softfloat.c +2 -2
index 81a7d1a..a1f4527 100644
@@ -2219,7 +2219,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return c ^ (signflip << 31);
+        return make_float32(float32_val(c) ^ (signflip << 31));
     }
 
     if (aExp == 0) {
@@ -3772,7 +3772,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return c ^ ((uint64_t)signflip << 63);
+        return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63));
     }
 
     if (aExp == 0) {
Signature · 1 line
1.7.7.6
Acked-by on v1 1/1
#2 lore raw
In reply to Juan Quintela

Am 20.03.2012 16:24, schrieb Juan Quintela:

Quoted 3 lines

This change makes it compile and return the same value than the #undef one.

Cool,

Tested the default, non-struct version only.

Juan, would it make sense to add a configure option for this #define, similar to --enable-debug-tcg?

Andreas

Quoted 26 lines
---
 fpu/softfloat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fpu/softfloat.c +2 -2
index 81a7d1a..a1f4527 100644
@@ -2219,7 +2219,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return c ^ (signflip << 31);
+        return make_float32(float32_val(c) ^ (signflip << 31));
     }
 
     if (aExp == 0) {
@@ -3772,7 +3772,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return c ^ ((uint64_t)signflip << 63);
+        return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63));
     }
 
     if (aExp == 0) {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 5 lines · Andreas Färber

Am 20.03.2012 16:24, schrieb Juan Quintela:

Quoted 3 lines

This change makes it compile and return the same value than the #undef one.

Quoted 8 lines

Cool,

Tested the default, non-struct version only.

Juan, would it make sense to add a configure option for this #define, similar to --enable-debug-tcg?

It depends of its users, clearly it was not used for quite long. Put in under --enabled-debug? Notice that I have only used this _once_, so I am not the best person to decide.

Later, Juan.

#4 lore raw
In reply to Andreas Färber
Quoted 4 lines · Andreas Färber

Tested the default, non-struct version only.

Juan, would it make sense to add a configure option for this #define, similar to --enable-debug-tcg?

We'd need to fix some of the other targets:
target-alpha/machine.c:25: error: invalid operands to binary - (have ‘uint64_t (*)[31]’ and ‘struct float64 (*)[31]’) target-m68k/helper.c:540: error: conflicting types for ‘helper_f64_to_i32’ target-microblaze/op_helper.c:447: error: incompatible types when assigning to type ‘uint32_t’ from type ‘float32’ target-mips/op_helper.c:2487: error: incompatible type for argument 1 of ‘float64_sqrt’
target-ppc/op_helper.c:1236: error: incompatible types when assigning to type ‘uint64_t’ from type ‘float64’
gdbstub.c:1177: error: incompatible type for argument 2 of ‘stl_le_p’ target-s390x/op_helper.c:1056: error: incompatible types when assigning to type ‘uint32_t’ from type ‘float32’ target-unicore32/translate.c:2094: error: aggregate value used where an integer was expected

(one sample error message only from each; eg mips has tons)

A quick look at gcc object files suggests that we do generate slightly worse code sometimes (a few extra insns here and there, esp. for float16). I think we could reasonably turn on this debug by default if --enable-debug is turned on (the way that --enable-debug-tcg is turned on by --enable-debug).

I think we should either have this type checking happen when you use --enable-debug or we should say we flat out don't care about float32/uint32_t mismatches; the current situation just means we accumulate errors without noticing.

-- PMM