132 Branch Optimizations Chapter 6
25112 Rev. 3.06 September 2005
Software Optimization Guide for AMD64 Processors
6.4 Pairing CALL and RETURN
Optimization
Always use care when pairing CALLs and RETURNs.
Application
This optimization applies to:
• 32-bit software
• 64-bit software
Rationale
When the 12-entry return-address stack gets out of synchronization, the latency of returns increases.
The return-address stack becomes unsynchronized when:
• Calls and returns do not match.
• The depth of the return-address stack is exceeded because of too many levels of nested function
calls.