On Mon, Apr 11, 2011 at 04:09:53PM +0100, Peter Maydell wrote: > On 11 April 2011 15:55, Nathan Froyd <froy...@codesourcery.com> wrote: > > On Sun, Apr 10, 2011 at 09:13:05PM +0200, Aurelien Jarno wrote: > >> SH4 is always using softfloat, so it's possible to have helpers directly > >> taking float32 or float64 value. This allow to get rid of conversions > >> through CPU_{Float,Double}U. > > > > Eh, I think this punning on i32/f32 and i64/f64 values is not healthy. > > But Peter's already said that the floats-as-structs bit of softfloat is > > broken, so maybe it's not worth trying to ensure floats-as-structs works > > (or even making it the default, to discourage people from bit-twiddling > > directly). > > I guess I should clarify that about the floats-as-structs thing. >
I think I should ask some more details about this floats-as-structs history. It has been added when a lot of targets were still using softfloat-native and it was still possible to think about being able to switch from one to another (at least having this goal). The idea was to avoid doing float computation on the wrong value. For example this code does work with softfloat-native, but will produce wrong results with softfloat: float64 fadd(float64 a, float64 b) { return a + b; } The problem with this kind of code is that it compiles both with softfloat and softfloat-native, but gives wrong results on softfloat. By adding this floats-as-structs, it was possible to catch such errors during compile time. However now that most targets (except i386) default to softfloat, we don't really need to forbid bit twiddling in target code. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net