Branchless programing on arduino?
There is no cache, so you don't need to worry about that. All instructions are fetched direct from flash and executed straight away.
There is, though, a 2-stage pipeline. That means that in one clock cycle an instruction is fetched from flash, and in the next clock cycle it's executed - and while that is being executed the next instruction is being fetched ready.
That means that when a branch occurs, since the AVR uses a very very simplistic approach to branch prediction (i.e., it assumes the branch will not be taken and just loads the next instruction regardless), it has to discard the contents of the pipeline and start from scratch.
That's only a one clock penalty while it loads the newly-branched-to instruction, but it's still a penalty.
Cache is only needed when the CPU core runs faster than the memory can be accessed. Since the AVR only runs at up to 20MHz that is considerably slower than the flash can be accessed, so adding cache would be completely pointless. Other faster MCUs do use caching, such as the 200MHz PIC32MZ, since otherwise &quot;wait states&quot; would have to be introduced to slow the reading from flash down.