summaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfpsingle.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-29 23:01:02 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-29 23:01:02 +0100
commit438a76167959061e371025f727fabec2ad9e70a7 (patch)
tree47991373507725b1307ab084a7d7bda5dd9ee1be /arch/arm/vfp/vfpsingle.c
parentb3402cf50efead37dd9553b90fbf1486e09fb78e (diff)
downloadlinux-438a76167959061e371025f727fabec2ad9e70a7.tar.gz
linux-438a76167959061e371025f727fabec2ad9e70a7.tar.bz2
linux-438a76167959061e371025f727fabec2ad9e70a7.zip
[PATCH] ARM: Fix VFP to use do_div()
VFP used __divdi3 64-bit division needlessly. Convert it to use our 64-bit by 32-bit division instead. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfpsingle.c')
-rw-r--r--arch/arm/vfp/vfpsingle.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c
index 6849fe35cb2e..14dd696ddeb1 100644
--- a/arch/arm/vfp/vfpsingle.c
+++ b/arch/arm/vfp/vfpsingle.c
@@ -32,6 +32,8 @@
*/
#include <linux/kernel.h>
#include <linux/bitops.h>
+
+#include <asm/div64.h>
#include <asm/ptrace.h>
#include <asm/vfp.h>
@@ -303,7 +305,11 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand)
if (z <= a)
return (s32)a >> 1;
}
- return (u32)(((u64)a << 31) / z) + (z >> 1);
+ {
+ u64 v = (u64)a << 31;
+ do_div(v, z);
+ return v + (z >> 1);
+ }
}
static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr)
@@ -1107,7 +1113,11 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr)
vsn.significand >>= 1;
vsd.exponent++;
}
- vsd.significand = ((u64)vsn.significand << 32) / vsm.significand;
+ {
+ u64 significand = (u64)vsn.significand << 32;
+ do_div(significand, vsm.significand);
+ vsd.significand = significand;
+ }
if ((vsd.significand & 0x3f) == 0)
vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32);