Opimise for MC68k CPUsAssembler/MC68000

The Motorola 68K family consists of a wide range of members from the micro-coded MC68000 to the super-scalar, hard-wired MC68060. This text will discuss the integer performance of the 68K family and ways to optimize both for the individual processors as well as produce code that runs well on any 68K processor.

In general, optimizations can take place on three different levels:

  1. On the assembly level for code that is written in assembly language.
  2. On the compiler level if the application is written in a high level language (i.e. C).
  3. On the user level by changing algorithms.
We will discuss what can be done to optimize 68K code concerning level 1.

The 68K family includes the following members:

The following table summarizes the characteristics of the different members in the 68000 family:
Processor
Cache
Register Add
Memory Add
Mul
Index
Branch
UAcc
HWFP
68000
None
6
18
40
18
10 / 6
no
no
68020
256 / 0
2
6
28
9
6 / 4
yes
68881/2
68030
256 / 256
2
5
28
8
6 / 4
yes
68881/2
CPU32
None
2
9
16
12
8 / 4
no
no
68040
4 K/4 K
1
1
16
3
2 / 3
yes
yes
68060
8 K/8 K
1
1
2
1
0 / 1
yes
yes

Register AddRegister to register 32 bit add (ADD.L D0,D1)
Memory AddAbsolute long address to register add (ADD.L _MEM,D1)
Mul16 x 16 multiplication (max. time) (MULU.W D0,D1)
IndexIndexed addressing mode (MOVE.L 2(A0,D0),D1)
BranchByte conditional branch taken / not taken (BNE.B Label)
UAccUnaligned access allowed (MOVE.L 0xFFFF0001,D1)
HWFPHardware floating point support

When optimizing for the 68K family, we divide the members into the following groups:

Since optimizations for one 68K processor can make another one execute slower, it is fairly important to know the individual instruction timings for each member. Here are some examples of different ways of doing operations and the preferred method for each 68K processor:

Summary of characteristics for each processor:
68000:

68020: 68040: 68060: 680xx: Note: This text was a bit longer, covering all 3 levels of optimisation, but since this is a MC68k specific text the rest has been cut. The text has also been slightly modified. The original author is unknown.
Gem writer: John Eckerdal
last updated: 1998-03-16