Pseudoinstructions: Branch | ||||||||||||
How do we compare values in 2 registers? | ||||||||||||
Instructions for beq, bne, but not for general relational operators | ||||||||||||
result | ||||||||||||
slt $rd, $rt, $rs | R[t] < R[s] | 1 | ||||||||||
R[t] >= R[s] | 0 | |||||||||||
Instruction | Real instructions | Semantics | ||||||||||
bge $rs, $rt, LABEL | slt $at, $rs, $rt | if (R[s] >= R[t]) | ||||||||||
beq $at, $zero, LABEL | goto LABEL | |||||||||||
bgt $rs, $rt, LABEL | slt $at, $rt, $rs | if (R[s] > R[t]) | ||||||||||
bne $at, $zero, LABEL | goto LABEL | |||||||||||