linux-mips
[Top] [All Lists]

RE: Soft floating point on 5K

To: "'Ralf Baechle'" <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: RE: Soft floating point on 5K
From: Dennis Castleman <DennisCastleman@oaktech.com>
Date: Mon, 14 Apr 2003 10:00:44 -0700
Cc: Gus Fernandez <GusFernandez@oaktech.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Ralf
 
Please re-post this with out the legal crap on the bottom.
 
Thanks

Dennis Castleman 

 -----Original Message-----
From: Dennis Castleman [mailto:DennisCastleman@oaktech.com]
Sent: Monday, April 14, 2003 9:53 AM
To: 'Ralf Baechle'; linux-mips@linux-mips.org
Cc: Gus Fernandez
Subject: Soft floating point on 5K

ALL 

I'm trying to run soft-floating point functions on a r5000 core with a FPU.
Without having to take the overhead of using a trap.  Using the files fp-bit.c and dp-bit.c
from the gcc source as a floating point lib.  This implementation lack in accuracy in
the least signeficant bit multiplication in division operations.

Using the floating point validation test from UCB(ucbtest), which validates
single and double precision operations for addition, subtraction, division
and multiplication. This test tests all difficult cases and edge conditions
(like combination of infinities, Nan etc.).

Here is the result with our soft-float library:-
Single precision Addition: Passed all 344 tests.
Single precision Subtraction: Passed all 316 tests
Single precision multiplication: Total: 334 Passed:313 Failed: 21
Single precision division: Total: 379 Passed: 375 Failed: 4
Double precision Addition: Passed all 352 tests.
Double precision Subtraction: Passed all 321 tests
Double precision multiplication: Total: 340 Passed: 319 Failed: 21
Double precision division: Total: 383 Passed: 379 Failed: 4

However, in all the failed cases there is only 1 bit different in the mantissa.
Essentially for some cases, it's less accurate by the minimum distance.


Any ideas in how to make this work or improve soft-floating point on a mips 5Kc?


Value error: divd n eq xu
        Input:    000FFFFF FFFFFFFE 3FEFFFFF FFFFFFFE
        Computed: 000FFFFF FFFFFFFE
        Expected: 000FFFFF FFFFFFFF xu
Value error: divd n eq xu
        Input:    000FFFFF FFFFFFF7 3FEFFFFF FFFFFFFE
        Computed: 000FFFFF FFFFFFF7
        Expected: 000FFFFF FFFFFFF8 xu
Value error: divd n eq xu
        Input:    800FFFFF FFFFFFF8 3FEFFFFF FFFFFFFE
        Computed: 800FFFFF FFFFFFF8
        Expected: 800FFFFF FFFFFFF9 xu
Value error: divd n eq xu
        Input:    001FFFFF FFFFFFFF 40000000 00000000
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 xu
Total  383 tests:  pass  379,  flags err    0,  value err   4,     divd
 ucbtest UCBFAIL in divd at line 701 for double


Value error: divs n eq xu
        Input:    007FFFFE 3F7FFFFE
        Computed: 007FFFFE
        Expected: 007FFFFF xu
Value error: divs n eq xu
        Input:    007FFFF7 3F7FFFFE
        Computed: 007FFFF7
        Expected: 007FFFF8 xu
Value error: divs n eq xu
        Input:    807FFFF8 3F7FFFFE
        Computed: 807FFFF8
        Expected: 807FFFF9 xu
Value error: divs n eq xu
        Input:    00FFFFFF 40000000
        Computed: 007FFFFF
        Expected: 00800000 xu
Total  379 tests:  pass  375,  flags err    0,  value err   4,     divs
 ucbtest UCBFAIL in divs at line 701 for float

Value error: muld n eq x?u
        Input:    000FFFFF FFFFFFF8 3FF00000 00000008
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 x?u
Value error: muld n eq x?u
        Input:    000FFFFF FFFFFFF8 BFF00000 00000008
        Computed: 800FFFFF FFFFFFFF
        Expected: 80100000 00000000 x?u
Value error: muld n eq x?u
        Input:    000FFFFF FFFFFFFF 3FF00000 00000001
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 x?u
Value error: muld n eq x?u
        Input:    00100000 00000001 3FEFFFFF FFFFFFFE
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 x?u
Value error: muld n eq x?u
        Input:    00100000 00000002 3FEFFFFF FFFFFFFC
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 x?u
Value error: muld n eq x?u
        Input:    20000000 02000000 1FFFFFFF FC000000
        Computed: 00000000 00000000
        Expected: 00100000 00000000 x?u
Value error: muld n eq x?u
        Input:    800FFFFF FFFFFFFF 3FF00000 00000001
        Computed: 800FFFFF FFFFFFFF
        Expected: 80100000 00000000 x?u
Value error: muld n eq xu
        Input:    00000000 00000001 3FEFFFFF FFFFFFFF
        Computed: 00000000 00000000
        Expected: 00000000 00000001 xu
Value error: muld n eq xu
        Input:    00000000 00000001 BFEFFFFF FFFFFFFF
        Computed: 80000000 00000000
        Expected: 80000000 00000001 xu
Value error: muld n eq xu
        Input:    000FFFFF FFFFFFF8 3FF00000 00000001
        Computed: 000FFFFF FFFFFFF8
        Expected: 000FFFFF FFFFFFF9 xu
Value error: muld n eq xu
        Input:    000FFFFF FFFFFFF8 BFF00000 00000001
        Computed: 800FFFFF FFFFFFF8
        Expected: 800FFFFF FFFFFFF9 xu
Value error: muld n eq xu
        Input:    000FFFFF FFFFFFFE 3FF00000 00000001
        Computed: 000FFFFF FFFFFFFE
        Expected: 000FFFFF FFFFFFFF xu
Value error: muld n eq xu
        Input:    000FFFFF FFFFFFFE BFF00000 00000001
        Computed: 800FFFFF FFFFFFFE
        Expected: 800FFFFF FFFFFFFF xu
Value error: muld n eq xu
        Input:    00100000 00000001 3FEFFFFF FFFFFFFA
        Computed: 000FFFFF FFFFFFFD
        Expected: 000FFFFF FFFFFFFE xu
Value error: muld n eq xu
        Input:    001FFFFF FFFFFFFF 3FE00000 00000000
        Computed: 000FFFFF FFFFFFFF
        Expected: 00100000 00000000 xu
Value error: muld n eq xu
        Input:    001FFFFF FFFFFFFF BFE00000 00000000
        Computed: 800FFFFF FFFFFFFF
        Expected: 80100000 00000000 xu
Value error: muld n eq xu
        Input:    800FFFFF FFFFFFF7 3FF00000 00000001
        Computed: 800FFFFF FFFFFFF7
        Expected: 800FFFFF FFFFFFF8 xu
Value error: muld n eq xu
        Input:    BFE00000 00000001 00000000 00000001
        Computed: 80000000 00000000
        Expected: 80000000 00000001 xu
Value error: muld n eq xu
        Input:    BFF80000 00000000 80000000 00000001
        Computed: 00000000 00000001
        Expected: 00000000 00000002 xu
Value error: muld n eq xu
        Input:    C0040000 00000001 00000000 00000001
        Computed: 80000000 00000002
        Expected: 80000000 00000003 xu
Value error: muld n eq xu
        Input:    C00C0000 00000000 80000000 00000001
        Computed: 00000000 00000003
        Expected: 00000000 00000004 xu
Total  340 tests:  pass  319,  flags err    0,  value err  21,     muld
 ucbtest UCBFAIL in muld at line 701 for double
 

 

<Prev in Thread] Current Thread [Next in Thread>