MIPS: Summary After Loops

 


Arithmetic Instructions

Name Syntax Meaning
add add $rd, $rs, $rt $rd = $rs + $rt
addu addu $rd, $rs, $rt $rd = $rs + $rt (unsigned)
sub sub $rd, $rs, $rt $rd = $rs - $rt
subu subu $rd, $rs, $rt $rd = $rs - $rt (unsigned)
addi addi $rd, $rs, constantValue $rd = $rs + constantValue
addiu addiu $rd, $rs, constantValue $rd = $rs + constantValue (unsigned)

Logical Instructions (so far)

Name Syntax Meaning
sll (shift left logical) sll $rd, $rs, shiftAmount shift $rd by shiftAmount, put in $rd
srl (shift right logical) srl $rd, $rs, shiftAmount shift $rd by shiftAmount, put in $rd

Memory Access Instructions (so far)

Name Syntax Meaning
lw (load word) lw $rd, offset($base) load word from address ($base+offset) to $rd
sw (store word) sw $rs, offset($base) store word from $rs to address ($base+offset)

Branch-Related Instructions (so far)

Name Syntax Meaning
beq (branch on equal) beq $rs, $rt, label branch to label if $rs == $rt
bne (branch on not equal) bne $rs, $rt, label branch to label if $rs != $rt
slt (set on less than) slt $rd, $rs, $rt set $rd to 1 if $rs < $rt
sltu (set on less than) sltu $rd, $rs, $rt set $rd to 1 if $rs < $rt (unsigned)

Jump Instructions (so far)

Name Syntax Meaning
j j label j to the address associated with label

Registers (so far)

Number Name Comments
0$zero constant 0
...
8
.
.
.
15
$t0
.
.
.
$t7
temporary (not preserved across function call)
.
.
.
temporary (not preserved across function call)
16
.
.
.
23
$s0
.
.
.
$s7
saved temporary (preserved across function call)
.
.
.
saved temporary (preserved across function call)
24
25
$t8
$t9
temporary (not preserved across function call)
temporary (not preserved across function call)
...

 


Alyce Brady, Kalamazoo College