Yahoo Groups archive

68300

Index last updated: 2026-04-29 00:01 UTC

Thread

64/32 division - repost with another From:

64/32 division - repost with another From:

2003-02-11 by Dimiter Popoff

Hi all,

I have written an assembler (or is it a compiler?) which produces
power PC code from CPU32 sources (and more than that, but this is
another topic). To my surprise, the code length is only about
3.5 times the length for CPU32 - without the optimization, which
I have yet to make work.

I got stuck with the division 64/32 bits the CPU32 has. The PPC
has 32/32 - and that's all.
 I know how to do it in a loop - have done it for several CPUs before.
 I also know how to do it using the FPU the PPC has - but I don't want
to do so, the on/off switch for the FPU is privileged while the divide
is user level.

 I still hope I am overlooking some obvious way to do the division
using the divide 32/32 plus a couple of shifts (like left-normalizing
the dividend and then right shifting back the quotient or something).
The PPC does not seem to have 'fractional division' in the sense, say,
the HC11 has (dividend*2^32/divisor would be OK for me, if I had it).

 Thanks in advance,

Dimiter

P.S. this webmail address of mine is still under test, please CC me with
your replies at tgi@....

------------------------------------------------------------------------
Dimiter Popoff
http://transgalactic.freeyellow.com

Re: [68300] 64/32 division - repost with another From:

2003-02-11 by Scott Newell

> I still hope I am overlooking some obvious way to do the division
>using the divide 32/32 plus a couple of shifts (like left-normalizing
>the dividend and then right shifting back the quotient or something).
>The PPC does not seem to have 'fractional division' in the sense, say,
>the HC11 has (dividend*2^32/divisor would be OK for me, if I had it).

Can you...
divide the high 32 by divisor, shift the quotient and remainder 32 bits
left, add the low 32 to the shifted remainder, divide again, and sum the
quotient with the shifted quotient?  (Hope I got the terms right!)

Obviously, there's a potential overflow when summing the shifted remainder
and the low 32 bits.


newell

Re: [68300] 64/32 division - repost with another From:

2003-02-11 by Scott Newell

>> I still hope I am overlooking some obvious way to do the division
>>using the divide 32/32 plus a couple of shifts (like left-normalizing
>>the dividend and then right shifting back the quotient or something).
>>The PPC does not seem to have 'fractional division' in the sense, say,
>>the HC11 has (dividend*2^32/divisor would be OK for me, if I had it).
>
>Can you...
>divide the high 32 by divisor, shift the quotient and remainder 32 bits
>left, add the low 32 to the shifted remainder, divide again, and sum the
>quotient with the shifted quotient?  (Hope I got the terms right!)
>
>Obviously, there's a potential overflow when summing the shifted remainder
>and the low 32 bits.


Nevermind...that's obviously not gonna work, 'cause you're back to the
64/32 bit divide again.  Sorry, guess I shouldn't try to do mental math
first thing in the morning.


newell

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.