Compare and Branch

A compare is a subtract that does not store its results; however, the results set the condition code, which can be tested by branch instructions.

cmp A,B compare A - B , integer
fcmpd A,B compare A - B , floating

The branch instructions test the condition code:

ba Branch always.
ble fble Branch if A &le B
be fbe Branch if A = B
bne fbne Branch if A &ne B
bge fbge Branch if A &ge B
bl fbl Branch if A < B
bg fbg Branch if A > B
nop no operation

Note that the effect of a branch is delayed by one instruction; therefore, a branch or call must be followed by an instruction, which may be useful or a nop. The instruction following the branch is executed before the branch is taken.

Contents    Page-10    Prev    Next    Page+10    Index