Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3011
b: refs/heads/master
c: c1241c4
h: refs/heads/master
i:
  3009: 505fc03
  3007: 4a31e59
v: v3
  • Loading branch information
Nicolas Pitre authored and Russell King committed Jun 23, 2005
1 parent c6b1b4c commit cb4b73c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf1b8ab6f21e1adbab1abd1b4e71c35fe65dc5fe
refs/heads/master: c1241c4c3a1507d76c7b987130f2f02f53ecc09f
22 changes: 18 additions & 4 deletions trunk/arch/arm/nwfpe/softfloat-macros
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,14 @@ static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b )
bits64 rem0, rem1, term0, term1;
bits64 z;
if ( b <= a0 ) return LIT64( 0xFFFFFFFFFFFFFFFF );
b0 = b>>32;
z = ( b0<<32 <= a0 ) ? LIT64( 0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32;
b0 = b>>32; /* hence b0 is 32 bits wide now */
if ( b0<<32 <= a0 ) {
z = LIT64( 0xFFFFFFFF00000000 );
} else {
z = a0;
do_div( z, b0 );
z <<= 32;
}
mul64To128( b, z, &term0, &term1 );
sub128( a0, a1, term0, term1, &rem0, &rem1 );
while ( ( (sbits64) rem0 ) < 0 ) {
Expand All @@ -573,7 +579,12 @@ static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b )
add128( rem0, rem1, b0, b1, &rem0, &rem1 );
}
rem0 = ( rem0<<32 ) | ( rem1>>32 );
z |= ( b0<<32 <= rem0 ) ? 0xFFFFFFFF : rem0 / b0;
if ( b0<<32 <= rem0 ) {
z |= 0xFFFFFFFF;
} else {
do_div( rem0, b0 );
z |= rem0;
}
return z;

}
Expand Down Expand Up @@ -601,6 +612,7 @@ static bits32 estimateSqrt32( int16 aExp, bits32 a )
};
int8 index;
bits32 z;
bits64 A;

index = ( a>>27 ) & 15;
if ( aExp & 1 ) {
Expand All @@ -614,7 +626,9 @@ static bits32 estimateSqrt32( int16 aExp, bits32 a )
z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );
}
return ( (bits32) ( ( ( (bits64) a )<<31 ) / z ) ) + ( z>>1 );
A = ( (bits64) a )<<31;
do_div( A, z );
return ( (bits32) A ) + ( z>>1 );

}

Expand Down
12 changes: 10 additions & 2 deletions trunk/arch/arm/nwfpe/softfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ this code that are retained.
===============================================================================
*/

#include <asm/div64.h>

#include "fpa11.h"
//#include "milieu.h"
//#include "softfloat.h"
Expand Down Expand Up @@ -1331,7 +1333,11 @@ float32 float32_div( float32 a, float32 b )
aSig >>= 1;
++zExp;
}
zSig = ( ( (bits64) aSig )<<32 ) / bSig;
{
bits64 tmp = ( (bits64) aSig )<<32;
do_div( tmp, bSig );
zSig = tmp;
}
if ( ( zSig & 0x3F ) == 0 ) {
zSig |= ( ( (bits64) bSig ) * zSig != ( (bits64) aSig )<<32 );
}
Expand Down Expand Up @@ -1397,7 +1403,9 @@ float32 float32_rem( float32 a, float32 b )
q = ( bSig <= aSig );
if ( q ) aSig -= bSig;
if ( 0 < expDiff ) {
q = ( ( (bits64) aSig )<<32 ) / bSig;
bits64 tmp = ( (bits64) aSig )<<32;
do_div( tmp, bSig );
q = tmp;
q >>= 32 - expDiff;
bSig >>= 2;
aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
Expand Down

0 comments on commit cb4b73c

Please sign in to comment.