Branches and jumps
Computational instructions alone run straight-line code with data in 32 registers. Programs also need to choose, repeat, and touch more data than fits in registers. Without control flow a thousand numbers need two thousand instructions; without memory access every value must live in a register at once.
Notation. register ; byte at ; halfword = 2 bytes, word = 4. / widen by sign or zeros.
Conditional branches: beq, bne, blt, bge, bltu, bgeu — jump to a label (±4 KiB, B-format offset) if the condition holds, else fall through. bgt/ble and beqz/bnez/bltz/… are pseudos that swap operands or use zero. jal rd, label reaches ±1 MiB and links; j is jal zero, label.
Worked. t0=-1, t1=1: blt jumps; bltu does not (t0 as unsigned is ). That unsigned reading catches both i ≥ n and negative i in one bgeu i, n, out_of_range.