Branch Improvement

Previous Motorola 680x0 Dependent Features Next

Certain pseudo opcodes are permitted for branch instructions. They expand to the shortest branch instruction that reach the target. Generally these mnemonics are made by substituting j for b at the start of a Motorola mnemonic.

The following table summarizes the pseudo-operations for the 68000 processor; the 68020 has some more possibilites. Note that the 68000 LONG operations are always absolute and require runtime relocation. They will not be used if the '--pcrel' option is given. A (*) flags cases that are more fully described after the table:

 Displacement
Pseudo-OpBYTEWORDLONG
jbsrbsr.sbsrjsr
jrabra.sbrajmp
jXX (*)bXX.sbXXbNX; jmp
dbXX (*)dbXXdbXXdbXX; bra; jmp

XX: condition
NX: negative of condition XX

jbsr
jra
These are the simplest jump pseudo-operations; they always map to one particular machine instruction, depending on the displacement to the branch target. This instruction will be a byte or word branch if that is sufficient. Otherwise, if the '--pcrel' option is not given, an absolute long jump will be emitted. If the '--pcrel' option is given and a word branch cannot reach the target, an error message is generated.

In addition to standard branch operands, as allows these pseudo-operations to have all operands that are allowed for jsr and jmp, substituting these instructions if the operand given is not valid for a branch instruction.

jXX
Here, jXX stands for an entire family of pseudo-operations, where XX is a conditional branch or condition-code test. The full list of pseudo-ops in this family is:

jhijlsjccjcsjnejeqjvc
jvsjpljmijgejltjgtjle

Usually, each of these pseudo-operations expands to a single branch instruction. However, if a word branch is not sufficient and the '--pcrel' option is not given, as issues a longer code fragment in terms of NX, the opposite condition to XX. For example, under these conditions:
    jXX foo
gives
     bNXs oof
     jmp foo
oof:
dbXX
The full family of pseudo-operations covered here is:

dbhidblsdbccdbcsdbnedbeqdbvc
dbvsdbpldbmidbgedbltdbgtdble
dbfdbradbt

Motorola dbXX instructions allow word displacements only. When a word displacement is sufficient, each of these pseudo-operations expands to the corresponding Motorola instruction. When a word displacement is not sufficient and long branches are available, when the source reads dbXX foo, as emits
     dbXX oo1
     bra.s oo2
oo1: jmp foo
oo2: