diff options
author | Nicolas Pitre <nico@cam.org> | 2005-06-23 16:56:46 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-06-23 16:56:46 -0400 |
commit | c1241c4c3a1507d76c7b987130f2f02f53ecc09f (patch) | |
tree | 8b34e8bd30c94c279a3cdabf8b13e05d1ef3dc77 /arch/arm/nwfpe/softfloat-macros | |
parent | bf1b8ab6f21e1adbab1abd1b4e71c35fe65dc5fe (diff) |
[PATCH] ARM: 2722/1: remove reliance on udivdi3 for nwfpe
Patch from Nicolas Pitre
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/nwfpe/softfloat-macros')
-rw-r--r-- | arch/arm/nwfpe/softfloat-macros | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/nwfpe/softfloat-macros b/arch/arm/nwfpe/softfloat-macros index 5469989f2c5e..5a060f95a58f 100644 --- a/arch/arm/nwfpe/softfloat-macros +++ b/arch/arm/nwfpe/softfloat-macros | |||
@@ -563,8 +563,14 @@ static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b ) | |||
563 | bits64 rem0, rem1, term0, term1; | 563 | bits64 rem0, rem1, term0, term1; |
564 | bits64 z; | 564 | bits64 z; |
565 | if ( b <= a0 ) return LIT64( 0xFFFFFFFFFFFFFFFF ); | 565 | if ( b <= a0 ) return LIT64( 0xFFFFFFFFFFFFFFFF ); |
566 | b0 = b>>32; | 566 | b0 = b>>32; /* hence b0 is 32 bits wide now */ |
567 | z = ( b0<<32 <= a0 ) ? LIT64( 0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32; | 567 | if ( b0<<32 <= a0 ) { |
568 | z = LIT64( 0xFFFFFFFF00000000 ); | ||
569 | } else { | ||
570 | z = a0; | ||
571 | do_div( z, b0 ); | ||
572 | z <<= 32; | ||
573 | } | ||
568 | mul64To128( b, z, &term0, &term1 ); | 574 | mul64To128( b, z, &term0, &term1 ); |
569 | sub128( a0, a1, term0, term1, &rem0, &rem1 ); | 575 | sub128( a0, a1, term0, term1, &rem0, &rem1 ); |
570 | while ( ( (sbits64) rem0 ) < 0 ) { | 576 | while ( ( (sbits64) rem0 ) < 0 ) { |
@@ -573,7 +579,12 @@ static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b ) | |||
573 | add128( rem0, rem1, b0, b1, &rem0, &rem1 ); | 579 | add128( rem0, rem1, b0, b1, &rem0, &rem1 ); |
574 | } | 580 | } |
575 | rem0 = ( rem0<<32 ) | ( rem1>>32 ); | 581 | rem0 = ( rem0<<32 ) | ( rem1>>32 ); |
576 | z |= ( b0<<32 <= rem0 ) ? 0xFFFFFFFF : rem0 / b0; | 582 | if ( b0<<32 <= rem0 ) { |
583 | z |= 0xFFFFFFFF; | ||
584 | } else { | ||
585 | do_div( rem0, b0 ); | ||
586 | z |= rem0; | ||
587 | } | ||
577 | return z; | 588 | return z; |
578 | 589 | ||
579 | } | 590 | } |
@@ -601,6 +612,7 @@ static bits32 estimateSqrt32( int16 aExp, bits32 a ) | |||
601 | }; | 612 | }; |
602 | int8 index; | 613 | int8 index; |
603 | bits32 z; | 614 | bits32 z; |
615 | bits64 A; | ||
604 | 616 | ||
605 | index = ( a>>27 ) & 15; | 617 | index = ( a>>27 ) & 15; |
606 | if ( aExp & 1 ) { | 618 | if ( aExp & 1 ) { |
@@ -614,7 +626,9 @@ static bits32 estimateSqrt32( int16 aExp, bits32 a ) | |||
614 | z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 ); | 626 | z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 ); |
615 | if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 ); | 627 | if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 ); |
616 | } | 628 | } |
617 | return ( (bits32) ( ( ( (bits64) a )<<31 ) / z ) ) + ( z>>1 ); | 629 | A = ( (bits64) a )<<31; |
630 | do_div( A, z ); | ||
631 | return ( (bits32) A ) + ( z>>1 ); | ||
618 | 632 | ||
619 | } | 633 | } |
620 | 634 | ||