diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-06-29 18:01:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-06-29 18:01:02 -0400 |
commit | 438a76167959061e371025f727fabec2ad9e70a7 (patch) | |
tree | 47991373507725b1307ab084a7d7bda5dd9ee1be /arch/arm/vfp/vfp.h | |
parent | b3402cf50efead37dd9553b90fbf1486e09fb78e (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.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h index 55a02bc994a3..4b97950984e9 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) | |||
117 | if (nh >= m) | 117 | if (nh >= m) |
118 | return ~0ULL; | 118 | return ~0ULL; |
119 | mh = m >> 32; | 119 | mh = m >> 32; |
120 | z = (mh << 32 <= nh) ? 0xffffffff00000000ULL : (nh / mh) << 32; | 120 | if (mh << 32 <= nh) { |
121 | z = 0xffffffff00000000ULL; | ||
122 | } else { | ||
123 | z = nh; | ||
124 | do_div(z, mh); | ||
125 | z <<= 32; | ||
126 | } | ||
121 | mul64to128(&termh, &terml, m, z); | 127 | mul64to128(&termh, &terml, m, z); |
122 | sub128(&remh, &reml, nh, nl, termh, terml); | 128 | sub128(&remh, &reml, nh, nl, termh, terml); |
123 | ml = m << 32; | 129 | ml = m << 32; |
@@ -126,7 +132,12 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m) | |||
126 | add128(&remh, &reml, remh, reml, mh, ml); | 132 | add128(&remh, &reml, remh, reml, mh, ml); |
127 | } | 133 | } |
128 | remh = (remh << 32) | (reml >> 32); | 134 | remh = (remh << 32) | (reml >> 32); |
129 | z |= (mh << 32 <= remh) ? 0xffffffff : remh / mh; | 135 | if (mh << 32 <= remh) { |
136 | z |= 0xffffffff; | ||
137 | } else { | ||
138 | do_div(remh, mh); | ||
139 | z |= remh; | ||
140 | } | ||
130 | return z; | 141 | return z; |
131 | } | 142 | } |
132 | 143 | ||