Chapter 7 Scheduling Optimizations 157
Software Optimization Guide for AMD64 Processors
25112 Rev. 3.06 September 2005
7.7 Pushing Memory Data Directly onto the Stack
Optimization
Push memory data directly onto the stack instead of loading it into a register first.
Application
This optimization applies to:
• 32-bit software
• 64-bit software
Rationale
Pushing memory data directly onto the stack reduces register pressure and eliminates data
dependencies.
Example
Avoid code that first loads the memory data into a register and then pushes it onto the stack:
mov rax, mem
push rax
Instead, push the memory data directly onto the stack:
push mem