# Subroutine Calls (Branch Link) **What is a subroutine?** A subroutine is *a block of code that performs a task based on some arguments and optionally returns a result.* **What is the Branch and Link (`BL`) instruction do?** The `BL` instruction *calls subroutines by using the Link Register (LR) to hold the return-from address.* ... # Compare And Branch ^67b6ff > [!example] Examples of the compare instructions and what they do > * `CBZ R3, label` - Compare `R3` to zero. If `R3 == 0` (`Z = 1`), then branch to `label`. Otherwise, do the following instruction. > * `CBNZ R3, label` - Compare `R3` to zero. If `R3 != 0` (`Z = 0`), then branch to label. Otherwise, do the following instruction. > * `CMP R3, R4` - Compare `R3` to `R4` using `R3 - R4` and update the status flags. If `R3 < R4`, then set the `N` flag to 1. If `R3 == R4`, then set the `Z` flag to 1. > * `CMP R3, #15` - Compare `R3` to 15 using `R3 - 15` and update the status flags... > * `CMN R3, R4` - Compare negative `R3` to `R4` using `R3+R4` and update the status flags. If `R3 < -R4`, then set the `N` flag to 1. If `R3 == -R4`, then set the `Z` to 1. ^474b91 **What are the different branch instructions and their behavior?** The different branch instructions and their behavior include: * `B, label` - Go to the code starting at `label`. * `BEQ label` - Go to the code starting at `label` if `Z == 1` (equal). ^c0516a * `BNE label` - Go to the code starting at `label` if `Z == 0` (not equal). * `BLT label` - Go to the code starting at `label` if `N == 1` (less than). * `BGT label` - Go to the code starting at `label` if `N == 0` (greater than). * `BGE label` - Go to the code starting at `label` if `N == 0` or `Z == 1` (greater than or equal to). > [!note] > [[Conditional Branch Instructions]]