5.3
Return stack
ARM DDI 0301H
ID012310
A return stack is used for predicting the class of program flow changes that includes loads,
moves, and ALU operations, writing to the PC that can be identified as being likely to be a
procedure call or return.
The return stack is a three-entry circular buffer used for the prediction of procedure calls and
procedure returns. Only unconditional procedure returns are predicted.
When a procedure call instruction is predicted, the return address is taken from the Execute stage
of the pipeline and pushed onto the return stack. The instructions recognized as procedure calls
are:
•
BL <dest>
•
BLX <dest>
•
.
BLX <reg>
The first two instructions are predicted by the BTAC, unless they result in a BTAC miss. The
third instruction is not predicted. The SBP predicts unconditional procedure calls as taken, and
conditional procedure calls as not taken.
When a procedure return instruction is predicted, an instruction fetch from the location at the
top of the return stack occurs, and the return stack is popped. The instructions recognized as
procedure returns are:
•
BX R14
•
LDM sp!, {...,pc}
•
.
LDR pc, [sp...]
The SBP only predicts procedure returns that are always predicted as taken.
Two classes of return stack mispredictions can exist:
•
condition code failures of the return operation
•
incorrect return location.
In addition, an empty return stack gives no prediction.
Copyright © 2004-2009 ARM Limited. All rights reserved.
Non-Confidential, Unrestricted Access
Program Flow Prediction
5-7