branch and jump instructions
Branch and jump instructions decide where to go next. Normally a processor reads instructions in a straight line, one after another, like reading down a page. But real programs need to make choices ('if the balance is negative, do this') and repeat work ('keep adding until the list ends'). Control-flow instructions are the forks and detours in that road: they change which instruction runs next instead of just falling through to the following one.
A branch is conditional — it tests something and only redirects if the test passes; otherwise execution continues normally. In RISC-V, 'beq x5, x6, target' means 'branch to target if x5 equals x6', and 'blt x5, x6, target' means 'branch if x5 is less than x6'. A jump is usually unconditional — it always redirects, used to implement function calls and unconditional 'go here' control. Mechanically, both work by changing the program counter (the register holding the address of the next instruction): a branch or jump computes a new address and loads it into the program counter, so the next fetch comes from there.
These instructions are how every 'if', loop, function call, and 'return' in a high-level language is ultimately built. A loop is just an arithmetic test followed by a backward branch; an 'if/else' is a branch that skips one block or another. They are also the reason fast processors work so hard at branch prediction: because the machine wants to keep fetching ahead, it must guess which way a branch will go before it actually knows — but that is a microarchitecture concern, not part of the ISA contract itself.
A countdown loop: at the top, 'beq x5, x0, done' branches out when the counter x5 hits zero; otherwise the body runs, 'addi x5, x5, -1' decrements it, and 'j top' jumps back. The branch ends the loop; the jump repeats it.
Loops and 'if's are built from a conditional branch plus an unconditional jump.
A branch only chooses an address; it does not 'remember' where it came from. Function calls need to save a return address separately (that is the job of a jump-and-link plus the calling convention), or the program would have no way back.