A6.3 Program flow prediction

Program flow prediction is always enabled when the MMU is enabled by setting the appropriate control bit in the relevant system control register.

As a general rule, the flow prediction hardware predicts all branch outcomes regardless of the addressing mode. For example, it predicts the outcomes of the following branch types:

  • Conditional branches.
  • Unconditional branches.
  • Indirect branches that are associated with procedure call and return instructions.
  • Branches that switch between A32 and T32 states.

However, the flow prediction hardware does not predict the branch outcomes for the following instructions:

  • Data-processing instructions that use the PC as a destination register.
  • The BXJ instruction.
  • Exception return instructions.

A T32 instruction set branch that is normally encoded as unconditional can be made conditional by inclusion in an If-Then (IT) block. Then it is treated as a conditional branch.

Return stack predictions

The return stack stores the return address and the A32 or T32 instruction set of the instruction after a procedure call type branch instruction. This address is equal to the link register value stored in r14. The following instructions cause a return stack push if predicted:

  • BL.
  • BLX (immediate).
  • BLX (register).

In AArch32 state, the following instructions cause a return stack pop if predicted:

  • BX
  • LDR pc, [r13], #imm
  • LDM r13, {…pc}
  • LDM r13, {…pc}!
Non-ConfidentialPDF file icon PDF versionARM 100241_0001_00_en
Copyright © 2016, 2017 ARM Limited or its affiliates. All rights reserved.