CS 350 INTRODUCTION TO MIPS ASSEMBLY LANGUAGE
Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions
Branch/Jump Instructions
Beq example
C Version:
if (i == j) go to L1:
f = g + h;
L1: f = f - i
[where f through j correspond to the five registers $s0 through $s4]
MIPS Version:
beq $s3, $s4, L1
add $s0, $s1, $s2
L1:
sub $s0, $s0, $s3
Bne example
C Version:
if (i == j)
f = g + h;
else
f = g - h;
[where f through j correspond to the five registers $s0 through $s4]
MIPS Version:
bne $s3, $s4, Else
add $s0, $s1, $s2
j Exit
Else:
sub $s0, $s1, $s2
Exit:
Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions