
4-16
32-Bit Instructions
4.6 32-Bit Jump and Branch Instructions
32-bit jump and branch instructions change program flow. All 32-bit jump
and branch instructions execute after a one-instruction delay. That is, the
instruction immediately following the jump or branch is always executed
while the target instruction is being fetched from storage. Refer to
Section 2.5, “Branch Delay Slot,” for a detailed discussion of the delayed
jump and branch instructions.
The J-type instruction format is used for both jump and jump-and-link
instructions for subroutine calls. In this format, the 26-bit target address
is shifted left two bits and combined with the 4 high-order bits of the
current program counter to create a 32-bit absolute address.
Table 4.12
32-Bit Shift Instruction Descriptions
Instruction
Format and Description
Shift Left
Logical
SLL rd, rt, shamt
Shifts the bits of register
rt
left by
shamt
bits, and inserts zeros into the low-order bits.
Stores the 32-bit result into register
rd.
Shift Right
Logical
SRL rd, rt, shamt
Shifts the bits of register
rt
right by
shamt
bits, and inserts zeros into the high-order
bits. Stores the 32-bit result into register
rd
.
Shift Right
Arithmetic
SRA, rd, rt, shamt
Shifts the bits of register
rt
right by
shamt
bits, and sign-extends the high-order bits.
Stores the 32-bit result into register
rd
.
Shift Left
Logical
Variable
SLLV rd, rt, rs
Shifts the bits of register
rt
left by the value contained in the low-order 5 bits of register
rs
. Inserts zeros into the low-order bits of register
rt
and stores the 32-bit result into
register
rd
.
Shift Right
Logical
Variable
SRLV rd, rt, rs
Shifts the bits of register
rt
right by the value contained in the low-order 5 bits of
register
rs
. Inserts zeros into the high-order bits of register
rt
and stores the 32-bit
result into register
rd
.
Shift Right
Arithmetic
Variable
SRAV rd, rt, rs
Shifts the bits of register
rt
right by the value contained in the low-order 5 bits of
register
rs
. Sign-extends the high-order bits of register
rt
and stores the 32-bit result
into register
rd.