aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/vfp/vfp.h
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/vfp.h
parentb3402cf50efead37dd9553b90fbf1486e09fb78e (diff)
[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/vfp.h')
-rw-r--r--arch/arm/vfp/vfp.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index 55a02bc994a..4b97950984e 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -117,7 +117,13 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m)
if (nh >= m)
return ~0ULL;
mh = m >> 32;
- z = (mh << 32 <= nh) ? 0xffffffff00000000ULL : (nh / mh) << 32;
+ if (mh << 32 <= nh) {
+ z = 0xffffffff00000000ULL;
+ } else {
+ z = nh;
+ do_div(z, mh);
+ z <<= 32;
+ }
mul64to128(&termh, &terml, m, z);
sub128(&remh, &reml, nh, nl, termh, terml);
ml = m << 32;
@@ -126,7 +132,12 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m)
add128(&remh, &reml, remh, reml, mh, ml);
}
remh = (remh << 32) | (reml >> 32);
- z |= (mh << 32 <= remh) ? 0xffffffff : remh / mh;
+ if (mh << 32 <= remh) {
+ z |= 0xffffffff;
+ } else {
+ do_div(remh, mh);
+ z |= remh;
+ }
return z;
}