Aligning data in memory / on the stack

Peter Alexander peter.alexander.au at gmail.com
Fri Sep 16 13:03:39 PDT 2011


Can anyone help me with this?

http://stackoverflow.com/questions/7375165/aligning-stack-variables-in-d

---

Is there a way to align data on the stack? In particular, I want to 
create an 16-byte aligned array of floats to load into XMM registers 
using movaps, which is significantly faster than movups.

e.g.

void foo()
{
     float[4] v = [1.0f, 2.0f, 3.0f, 4.0f];
     asm
     {
         movaps XMM0, v; // v must be 16-byte aligned for this to work.
         ...
     }
}


More information about the Digitalmars-d-learn mailing list