Help needed on inline assembly
Don Clugston
dac at nospam.com.au
Thu Jan 31 05:43:42 PST 2008
Hendrik Renken wrote:
> Jarrett Billingsley wrote:
>> "Hendrik Renken" <funsheep at -[no-spam]-gmx.net> wrote in message
>> news:fnqet1$1on0$1 at digitalmars.com...
>>
>>> Doesnt seem to work for me (using DMD 1.026 on linux). Or the aligment
>>> is in 1.026 broken again...
>>
>> Ah, it's probably because of Linux. That code works on Windows. I
>> forgot that DMD uses ELF on Linux like GDC. DMD maybe can't control
>> the alignment of the data there.
>>
>> Either that, or it's a genuine bug. :\
>
> i did some more testing, it seems that dynamically allocated data is
> aligned. for that i can use movaps. however statically allocated data is
> not aligned. but we can allocate 1 to 3 ints/floats/etc before the data,
> until it is aligned ;)
That's what I found on Windows, and persuaded Walter to fix it. I didn't realise
it wasn't working on Linux yet.
I hope that eventually we'll get stack data properly aligned; if it gets into
the D ABI, then we only have to worry about callbacks from C -- ie, only
extern() functions would need to align the stack.
> thanks for the help, got it working - and a speedup factor of 240! yeah.
> from 480 millisec down to 2 millisec with sse instructions.
>
> that rocks!
Oh yeah!
DMD's floating point code generation is very basic; it does almost no
optimisation; and it's excellent support for inline asm makes asm particularly
attractive.
But a factor of 240 is pretty extreme.
More information about the Digitalmars-d-learn
mailing list