Access 'this' in inline assembly
Simon
s.d.hammett at gmail.com
Mon Mar 7 15:39:08 PST 2011
On 07/03/2011 19:45, Emil Madsen wrote:
> On 7 March 2011 20:37, Simen kjaeraas <simen.kjaras at gmail.com
> <mailto:simen.kjaras at gmail.com>> wrote:
>
> Martin Kinkelin <noone at spam.com <mailto:noone at spam.com>> wrote:
>
> Thanks,
>
> movups XMM0, [EAX];
>
> works. The SSE version takes more than 160% of the run-time
> compared to the naive
> version though. ;)
>
>
> Yup. Functions using inline assembly are never inlined, so that's rarely
> a good reason to use it.
>
> --
> Simen
>
>
> Is this just a fact of the current state of dmd, or is it by design? -
> and if thats the case, why?
>
> --
> // Yours sincerely
> // Emil 'Skeen' Madsen
It's by design. I've seen it explicitly stated somewhere (I forget) that
the compiler won't optimise across asm blocks and in-lining is just a
case of optimisation.
As to way, my guess is because of the way a compiler is designed and
implemented.
Each stage of the compiler processes it's input, converts it to a lower
level representation and then hands it off to the next stage.
Optimising across asm blocks would require reversing that process;
I think it's doable but it's highly non trivial and then you have to
implement that across every supported target.
Better to spend the time improving the higher level code generation
stages so people don't have to resort to ASM at all.
I guess in-lining could be separated out from the optimisation passes;
but don't hold your breath. DMD is a hodge podge of mashed together
functionality, just re-factoring out in-lining would be weeks of work.
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
More information about the Digitalmars-d-learn
mailing list