delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/22:36:47

To: djgpp AT delorie DOT com
Subject: Re: floating point is... fast???
Message-ID: <19970120.191504.4983.0.chambersb@juno.com>
References: <199701201847 DOT KAA27949 AT sirius DOT cs DOT pdx DOT edu>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Mon, 20 Jan 1997 22:15:36 EST

On Mon, 20 Jan 1997 10:47:50 -0800 (PST) Ian D Romanick <idr AT cs DOT pdx DOT edu>
writes:
>> >Yes, floating point is faster because imul and idiv use the 
>floating
>> >point unit to do the operations - thus an integer mul/divide has 
>the
>> >overhead of converting the int -> float, div/mul, then float -> 
>int.
>> >Whereas the floating point calculations just do the div/mul...
>> 
>> If this were true, I couldn't do ANY multiplication/division on my
>> computer, since I have no FPU (I'm not counting Emulators here).
>> The integer mul/div routines are so slow precisely *because* they do 
>not
>> use the FPU - they use the integer unit, which was not made for
>> mul/div's.
>
>Ok, what he did not say is this is the case on a Pentium, which is 
>true.
>On a 486 or lower, an integer multiply/divide will be faster than
>floating point.  I don't know what you mean by "was not made for
>mul/div's".  All x86 CPUs have a hardware multiplier (unlike the 6502,
>older versions of SPARC, and others), so I'm not sure what you're 
>trying
>to say here.
The multiplication/division capabilities of the x86 chips were not
optimized to the extant other commands were.  With the Pentium (actually
the 486, but not to the same extant) Intel began making their chips
RISC-like (ie, you still have complex functions, but it's often faster to
break tasks into the simplest functions possible).  This means you need
to find more ingenuitive ways to multiply :)

...Chambers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019