Lower than C?
Christopher Wright
dhasenan at gmail.com
Fri Dec 7 05:47:55 PST 2007
Don Clugston wrote:
>> The only problem is that combining these may not be nearly as
>> efficient as writing the code manually. I'm sure there's a workaround,
>> though.
>
> Yes. It's called CTFE + string mixins. And you can do better than a
> traditional hand-crafted library of asm code, because you can also
> optimise the way it's called. Eg, checks for special cases can be moved
> out of the asm library into the user's D code, so that the compiler has
> a chance to optimise them away.
> <g>.
I meant, you have your inline asm library, and given a certain pattern
of usage, the best registers to use in a certain step will be different.
You can do that if it's not at compile time, but CTFE doesn't allow you
to alter global state. So you'd have to pass in the full guts of your
loop rather than assembling out of parts, though the CTFE parser could
pawn off portions by telling the modular asm interpreters which
registers to use.
Not so hard a problem, then; you just need a pretty good CTFE parser.
More information about the Digitalmars-d
mailing list