SIMD support...

Martin Nowak dawg at dawgfoto.de
Thu Jan 5 21:14:16 PST 2012


On Fri, 06 Jan 2012 04:22:41 +0100, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 1/5/2012 6:25 PM, Manu wrote:
>> Are you talking about for parameter passing, or for local variable  
>> assignment on
>> the stack?
>> For parameter passing, I understand the x32 problems with aligning the  
>> arguments
>> (I think it's possible to work around though), but there should be no  
>> problem
>> with aligning the stack for allocating local variables.
>
> Aligning the stack. Before I say anything, I want to hear your  
> suggestion for how to do it efficiently.

extending

push RBP;
mov RBP, RSP;
sub RSP, localStackSize;

to

push RBP;
// new
mov  RAX, RSP;
and  RAX, localAlignMask;
sub  RSP, RAX;
// wen
mov  RBP, RSP;
sub  RSP, localStackSize;

should do the trick.
This would require to use biggest align attribute
of all stack variables for localAlignMask. Also align
needed to be power of 2 of it isn't already.

------------
RBP + 0   int a;
RBP + 4   int b;
24 byte padding
RBP + 32  align(32) struct float8 { float[8] v; } s;
------------


More information about the Digitalmars-d mailing list