6.1.1.8 Relative Branches

The PIC18 devices implement conditional relative branch instructions, e.g., bz, bnz. These instructions have a limited jump range compared to the goto instruction.

Note that in some instances, the assembler can change a relative branch instruction to be a relative branch with the opposite condition over a goto instruction. For example:
  bz error
  ;next
can become:
  bnz l18
  goto error
l18:
  ;next

This transformation is made so that a conditional branch can be made to span the same range as a goto instruction.

This substitution will not take place for hand-written assembly placed in-line with C code or in separate modules, or for assembly source that is protected with the ASMOPT directive (see 6.1.9.2 Asmopt Directive).