Re: you can't bash Microsoft enough
- From: John Larkin <jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 03 May 2007 10:00:15 -0700
On Thu, 03 May 2007 16:38:02 +0000, Mike Monett <No@xxxxxxxxx> wrote:
John Larkin <jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I sometimes use a little math/ascii conversion package I wrote for
> the 68K. The math format is 32.32, a longword of signed integer
> plus a longword of fraction. That's adequate for near any
> real-world variables. It's blindingly fast compared to floats (no
> normalizing!) and conversion into/out of integers is
> instantaneous. All the math functions saturate, so most of the
> time it's safe to ignore exceptions, including division by 0.
> John
If you haven't come across it yet, Paul Hsieh has several pages on
integer math for the x86 that might be useful:
"Integer multiplying by constants"
the x86 ISA also includes lea, sub and mov (for shuffling partial
results amongst other registers.) Instructions like sub and mov are
self explanatory, but lea is a very curious and powerful instruction
that gives some multiregister linear combinations as well as some
additional odd multiplies. The x86's "lea" instruction allows you to
compute:
r0 := r1 * {0,1} + r2 * {0,1,2,4,8}
for any 3 general purpose 32 bit registers, in a single clock.
"sub" (subtract) and "mov" (copy value to/from register) are self
explanatory. So using these instructions, we see that 181 =
4*(5*9)+1 which can be encoded as: b = x*5; b = b*9; return x + b*4;
http://www.azillionmonkeys.com/qed/amult.html
"Pentium Optimal x86 Constant Multiplies"
http://www.azillionmonkeys.com/qed/amultl2.html (235k)
"Integer division and modulus by constants"
http://www.azillionmonkeys.com/qed/adiv.html
"Square Roots"
http://www.azillionmonkeys.com/qed/sqroot.html
Regards,
Mike Monett
The 8008 (I think they call the latest version "Core Duo" or
something) is a grotesque hack that needs all the help it can get. The
68332 has 32x32 -> 64 signed or unsigned multiply and 64/32 divide
with remainder, all in hardware.
And 16 32-bit registers!
John
.
- Follow-Ups:
- Re: you can't bash Microsoft enough
- From: Mike Monett
- Re: you can't bash Microsoft enough
- From: websnarf
- Re: you can't bash Microsoft enough
- References:
- Re: you can't bash Microsoft enough
- From: jasen
- Re: you can't bash Microsoft enough
- From: Paul Burke
- Re: you can't bash Microsoft enough
- From: John Larkin
- Re: you can't bash Microsoft enough
- From: MooseFET
- Re: you can't bash Microsoft enough
- From: John Larkin
- Re: you can't bash Microsoft enough
- From: MooseFET
- Re: you can't bash Microsoft enough
- From: John Larkin
- Re: you can't bash Microsoft enough
- From: MooseFET
- Re: you can't bash Microsoft enough
- From: John Larkin
- Re: you can't bash Microsoft enough
- From: Mike Monett
- Re: you can't bash Microsoft enough
- Prev by Date: Re: Semi-OT: How to throttle a AMD Turion?
- Next by Date: Re: Semi-OT: How to throttle a AMD Turion?
- Previous by thread: Re: you can't bash Microsoft enough
- Next by thread: Re: you can't bash Microsoft enough
- Index(es):
Relevant Pages
|