Software Optimization Guide for AMD64 Processors

25112 Rev. 3.06 September 2005

6.4Pairing 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.

132

Branch Optimizations

Chapter 6

Page 148
Image 148
AMD 250 manual Pairing Call and Return, 132