Conditional branches:
-
Branch to a label intsruction if a condition is true
- otherwise continue sequentially
-
beq (branch equal)
beq rs1, rs2, L1
- if (
rs1==rs2
) branch instruction labeled L1
- telling cpu if rs1 == rs2 it reads whatever L1 (memory address)
- if not true continue code skip
-
bne (branch not equal)
bne rs1, rs2, L1
- if (
rs1 != rs2
) branch instruction labeled L1
- telling cpu if rs1 != rs2 read whatever L1 (memory address)
- if true continue code skip
-
If statement
Conditional branch-less
-
much like branches but differnet
-
blt
blt rs1, rs2, L1
- if
rs1<rs2
branch to instruction labeled L1
-
bge
bge rs1, rs2, L1
- if
rs1 >= rs2
branch to instruction labeled L1
Basic blocks
-
basicl blocks is a sequence of instruction with no branches or any jumps