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, in AArch32, 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 in AArch32 state or X30 in AArch64 state. The following instructions cause a return stack
push if predicted:
• BL.
• BLX (immediate) in AArch32 state.
• BLX (register) in AArch32 state.
• BLR in AArch64 state.
In AArch32 state, the following instructions cause a return stack pop if predicted:
• BX
• LDR pc, [r13], #imm
• LDM r13, {…pc}
• LDM r13, {…pc}!
In AArch64 state, the RET instruction causes a return stack pop.
Because return-from-exception instructions can change processor privilege mode and security state, they
are not predicted. This includes:
• LDM (exception return)
• RFE
• SUBS pc, lr
• ERET
Related information
B1.105 System Control Register on page B1-331
B2.90 System Control Register, EL1 on page B2-525
B2.91 System Control Register, EL2 on page B2-529
B2.92 System Control Register, EL3 on page B2-532
A6 L1 Memory System
A6.3 Program flow prediction
100236_0100_00_en Copyright © 2015–2017, 2019 Arm Limited or its affiliates. All rights
reserved.
A6-92
Non-Confidential