SIMD support...

Manu turkeyman at gmail.com
Fri Jan 6 06:05:41 PST 2012


On 6 January 2012 08:22, Walter Bright <newshound2 at digitalmars.com> wrote:

> On 1/5/2012 7:42 PM, Manu wrote:
>
>> Perhaps I misunderstand, I can't see the problem?
>> In the function preamble, you just align it... something like:
>>   mov reg, esp ; take a backup of the stack pointer
>>   and esp, -16 ; align it
>>
>> ... function
>>
>>   mov esp, reg ; restore the stack pointer
>>   ret 0
>>
>
> And now you cannot access the function's parameters anymore, because the
> stack offset for them is now variable rather than fixed.
>

Hehe, true, but not insurmountable. Scheduling of parameter pops before you
perform the alignment may solve that straight up, or else don't align esp
its self; store the vector to the stack through some other aligned reg
copied from esp...

I just wrote some test functions using __m128 in VisualC, it seems to do
something in between the simplicity of my initial suggestion, and my
refined ideas one above :)
If you have VisualC, check out what it does, it's very simple, looks pretty
good, and I'm sure it's optimal (MS have enough R&D money to assure this)

I can paste some disassemblies if you don't have VC...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120106/09763716/attachment.html>


More information about the Digitalmars-d mailing list