Why does the Mac ABI require 16-byte stack alignment for x86-32?

From “Intel®64 and IA-32 Architectures Optimization Reference Manual”, section 4.4.2:

“For best performance, the Streaming SIMD Extensions and Streaming SIMD Extensions 2 require their memory operands to be aligned to 16-byte boundaries. Unaligned data can cause significant performance penalties compared to aligned data.”

From Appendix D:

“It is important to ensure that the stack frame is aligned to a 16-byte boundary upon function entry to keep local __m128 data, parameters, and XMM register spill locations aligned throughout a function invocation.”

http://www.intel.com/Assets/PDF/manual/248966.pdf

Leave a Comment