Originally Posted by psycho12345 ![]() In terms of performance, yeah its VASTLY faster to use the stack which is on the CPU then the memory, which is way far away (relatively). |
When saving or restoring registers in function prologues or epilogues, or when passing arguments through the stack, use PUSH or POP instructions to improve performance and to reduce code size. When deallocating stack space at function exit, use RET imm to improve performance and to reduce code size. |
In spite of the implicit dependency between several successive PUSH or POP instructions on the stack-pointer (which PUSH and POP modify), special circuitry (the Sideband Stack Optimizer) tracks the value that the stack-pointer assumes, allowing parallel execution of more than one PUSH or POP. This is also true of instructions that reference the stack-pointer, either implicitly or explicitly, including:
|
Faster PUSH/POP with the Sideband Stack Optimizer AMD Family 10h processors have added a sideband stack optimizer (SSO). This special circuitry removes the dependency that arises during chains of PUSH and POP operations on the rSP register and, thereby, improves the efficiency of the PUSH and POP instructions. The SSO also improves the performance of CALL and RET instructions, among others. (See "Stack Operations" on page 59.) |