SPARC Assembly/Control Flow

Comparison
compares two numbers (Subtraction). Sets flags.

tests two numbers (performs 'and' operation). Sets flags.

Jump Instructions
jumps to specified indirect address. stores return address in %o7.

Performs an unconditional, register indirect jump. Target address is provided in the first operand, and the return address is then stored into the rd operand.

jmpl rs1, rd

If the return address is stored in %o7, this acts like a subroutine call. If the return address is stored in %g0, it acts like a subroutine return.

Sets the highest 22 bits of the target register, sets the lowest 10 bits to zero.

sethi const22, rd

const22 must be a constant value, cannot be a register.

Subroutine Instructions
calls a subroutine. Takes a single label as a new target address. Stores the return address in %o7. cannot jump to a register indirect address.

return from a subroutine.

return from a leaf subroutine.

Return from a trap instruction, or from a register indirect control transfer.

saves the current register window and creates a new window. raises an exception if there is a register window overflow.

restores a saved register window.

Branch Instructions
branches do not store the return address.

Branch always. an unconditional jump to the target location. d

Branch never.

branches if the two operands are equal or not equal, respectively.

branches on "less than"

branches on "less than or equal"

branches on "greater than or equal"

branches on "greater than"

Same as bl and ble, except uses unsigned numbers

Same as bge and bg, except uses unsigned numbers

branches if the number is positive.

branches if the number is negative.

branches if the carry bit is set or clear, respectively.

branches if the signed overflow bit is set or clear, respectively.