[Issue 2278] Guarantee alignment of stack-allocated variables on x86

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 10 07:33:25 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=2278


MCD <s_lange at ira.uni-karlsruhe.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |s_lange at ira.uni-karlsruhe.d
                   |                            |e


--- Comment #13 from MCD <s_lange at ira.uni-karlsruhe.de> 2014-03-10 07:33:21 PDT ---
The problem about alignment of the stack for (128 bit) SSE is, that it even
needs to be aligned to 16 byte (or double quadrouble word) boundary for fast
access (via aligned moves), 8 byte (or quadword) won't be enough(yes, there are
unaligned SSE move instructions, but...). And that's only for basic 128 bit
SSE, AVX may take 256 bit or even 512 bit alignment, at least when you need to
use fast aligned move instructions.

Hopefully, no (pure) 32 bit x86 CPU has 256 or 512 bit AVX registers. However,
it's possible to use the upper parts of 256 or 512 bit AVX registers in 32 bit
Windows on a 64 bit CPU in 32 bit compatibility mode, but I'm not sure whether
older versions of Windows do recognize and correctly save/restore them on
context switch, which is essential for using them safely (someone needs to
check this out).

so here you have it. 32-bit Windows requires 16 byte alignment for SSE. 64-bit
Windows already has 16 byte alignment, but may require even more if AVX
registers are used.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list