Mail Archives: djgpp/1998/06/19/13:13:23
Rob Kramer wrote:
> Can anyone make a guess if multiplications/devisions in fixed point math
> are still faster on a machine that has a FPU? I was wondering if it would
> do any good to #define my code to use conventional floats if the machine
> supports it. (I'm using Allegro's fixed math stuff b.t.w)
Depends on the CPU, in a 486 fixed will be normally faster if one of the
values is know:
FMUL: 11 to 16 clocks (average values for different situations) 2 to 3 clocks
if cache miss. 8 to 13 clocks in concurrent execution.
FDIV: 73, 2 to 3, 70
A fixed MUL/DIV is reduced to shifts and adds when one of the values is know so
is just a few clocks.
MUL: 13 to 42 for DWORDs (doesn't say what's the average)
DIV: 40 for DWORDs
IDIV: 43 for DWORDs
As you can see the integer div is faster but the MUL is slower.
I think that Pentiums have better floating point. So if your calculation is
mostly MULs use the FPU.
Note that ADD and SUB are VERY slow in the 486 FPU so if you have an important
number of sums (20%? or more) integers will be better.
And the best of all is to mix both like in the Quake engine, but I doubt you
need such a huge optimization (They are concurrently executed).
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -