go to previous page   go to home page   hear noise   go to next page

Rotate right the following bit pattern by two bit positions:




Rotate Instructions

The rotate instructions are both pseudoinstructions. Each one takes four basic instructions to implement. The shift amount is given in a register or as an immediate operand.

rol d,s,t    # d <—s rotated left by t
             # (pseudoinstruction)
ror d,s,t    # d <— s  rotated right by t
             # (pseudoinstruction)

Negative immediate operands are not allowed. However, if the third operand is a register it may contain a negative integer. In that case the rotation is the opposite direction.


Inspect the following:

li  $t2,-2
li  $t1,4
ror $t0,$t1,$t2

What does $t0 hold after the sequence has executed?