Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-18 Thread Tom Musta
On 12/18/2013 12:03 PM, Peter Maydell wrote: > On 18 December 2013 17:32, Tom Musta wrote: >> On 12/17/2013 11:45 AM, Peter Maydell wrote: >> >> This seems to assume that the only case where flags could be set in >> float64_to_uint32 is the case where a large result is returned. Is >> this really

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-18 Thread Peter Maydell
On 18 December 2013 17:32, Tom Musta wrote: > On 12/17/2013 11:45 AM, Peter Maydell wrote: >> I'm partway through fixing this bug in an implementation of >> float*_to_uint16 which the ARM AArch64 needs. I think the >> cleanest approach to this looks like this: >> >> uint32 float64_to_uint32( float

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-18 Thread Tom Musta
On 12/17/2013 11:45 AM, Peter Maydell wrote: > On 11 December 2013 20:39, Tom Musta wrote: >> On 12/11/2013 1:53 PM, Peter Maydell wrote: >>> On 11 December 2013 19:16, Tom Musta wrote: uint32 float64_to_uint32( float64 a STATUS_PARAM ) { -int64_t v; +uint64_t v; >>>

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-17 Thread Peter Maydell
On 17 December 2013 17:45, Peter Maydell wrote: > I'm partway through fixing this bug in an implementation of > float*_to_uint16 which the ARM AArch64 needs. I think the > cleanest approach to this looks like this: > > uint32 float64_to_uint32( float64 a STATUS_PARAM ) > { > int64_t v; > u

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-17 Thread Peter Maydell
On 11 December 2013 20:39, Tom Musta wrote: > On 12/11/2013 1:53 PM, Peter Maydell wrote: >> On 11 December 2013 19:16, Tom Musta wrote: >>> uint32 float64_to_uint32( float64 a STATUS_PARAM ) >>> { >>> -int64_t v; >>> +uint64_t v; >>> uint32 res; >>> >>> -v = float64_to_int64(a

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-11 Thread Tom Musta
On 12/11/2013 1:53 PM, Peter Maydell wrote: > On 11 December 2013 19:16, Tom Musta wrote: >> uint32 float64_to_uint32( float64 a STATUS_PARAM ) >> { >> -int64_t v; >> +uint64_t v; >> uint32 res; >> >> -v = float64_to_int64(a STATUS_VAR); >> -if (v < 0) { >> -res = 0;

Re: [Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-11 Thread Peter Maydell
On 11 December 2013 19:16, Tom Musta wrote: > uint32 float64_to_uint32( float64 a STATUS_PARAM ) > { > -int64_t v; > +uint64_t v; > uint32 res; > > -v = float64_to_int64(a STATUS_VAR); > -if (v < 0) { > -res = 0; > -float_raise( float_flag_invalid STATUS_VAR)

[Qemu-devel] [V2 PATCH 11/18] softfloat: Fix float64_to_uint32

2013-12-11 Thread Tom Musta
The float64_to_uint32 has several flaws: - for numbers between 2**32 and 2**64, the inexact exception flag may get incorrectly set. In this case, only the invalid flag should be set. test pattern: 425F81378DC0CD1F / 0x1.f81378dc0cd1fp+38 - for numbers between 2**63 and 2**64, inc