[rec.games.programmer] MC68020.68881 add, div, mul, fadd, fdiv, fmul timings

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (04/21/91)

 conners@cs.fau.edu (Sean Conner) writes:
> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes:

>> Just in case you're interested:  the times for the 486 are
>>
>>  IDIV    19-44
>>  FDIV    73
>>  IMUL    13-42
>>  FMUL    11-16

>> So it looks as though floating point math would be a contender, even
>> without a MIPS, as long as you avoided the divides. I don't know the
>> algorithms you want to use, but very often the denominator in a
>> series of divides stays the same for a long time, so you can replace
>> it with a series of multiplies by the reciprocal. > >Duncan Murdoch
>> >dmurdoch@watstat.waterloo.edu

> So, we have the 386/387 covered. What about the 68020/68881(2)? I have
> an Amiga at home :-)

Lord knows if I'm reading these right, but:

68020:

    Instruction        Best Case     Cache Case    Worst Case
  ADD      EA,Dn           0             2             3
  ADD      EA,An           0             2             3
  ADD      Dn,EA           3             4             6
  MUL.W    EA,Dn          25            27            28
  MUL.L    EA,Dn          41            43            44
  DIVU.W   Ea,Dn          42            44            44
  DIVU.L   Ea,Dn          76            78            78
  DIVS.W   Ea,Dn          54            56            56
  DIVS.L   Ea,Dn          88            90            90

68881:

Overall Execution Time:

              FPn        Memory source or destination operand format
Instruction  Source    Integer   Single    Double    Extended  Packed
  FADD         51         80        72        78        76       888
  FMUL         71        100        92        98        96       908
  FDIV        103        132       124       130       128       940

For the integer or single cases, a footnote says to subtract 5 or 2
clock cycles respectively if either is in a MC68020 data register.


Overlap Allowed Time:

 Operand            FPm          Memory source or destination operand format
   Type            Source    Integer   Single    Double    Extended  Packed
FPn Destination *   -12        -31       -31      -37        -43       -43
Move to Memory  **   --         50        38       38         18     ~1942

*  Subtract these numbers from the overall execution time value in the
   previous table to determine the allowed overlap time for a particular
   instruction.  The result of this calculation includes 9 clocks of
   allowed overlap with the previous MC68881 instruction.

** These numbers represent the amount of time in the middle of the
   instruction during which the MC68020 may process interrupts.  An
   additional period of 9 clocks is allowed to overlap with the
   execution of the previous MC68881 instruction.

~  Indicates a typical time for the binary-to-decimal conversion.

There's lots more tables, and I don't even know what those mean, but perhaps
that will help.  However, it looks like even with instruction overlap in
the 68881 pipeline(?), long integer operations win over floating point with
this pair.  Sorry, I don't have the 68882 manual.

Kent, the man from xanth.
<xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>