seeding the pot for 2.0 features [small vectors]

Joel C. Salomon JoelCSalomon at Gmail.com
Tue Jan 30 17:53:03 PST 2007


Mikola Lysenko wrote:
>     Inline assmeber can not be inlined.  Period.  The compiler has to 
> think of inline assembler as a sort of black box, which takes inputs one 
> way and returns them another way.  It can not poke around in there and 
> change your hand-tuned opcodes in order to pass arguments in arguments 
> more efficiently.  Nor can it change the way you allocate registers so 
> you don't accidentally trash the local frame.  It can't manipulate where 
> you put the result, such that it can be used immediately by the next 
> block of code.  Therefore any asm vector class will have a lot of 
> wasteful function calls which quickly add up:

Sounds like what’s needed is in-line intermediate code rather than 
in-line assembly — or, at least some way to tell the compiler “do this 
operation on some block of eight SIMD registers; I don’t particularly 
care which.”

One way do do this could be with something like C’s ‘register’ keyword. 
  Not sure on D’s inline assembler syntax, but a possible solution could 
look like:
	register int a;
	asm{
		addl	0x32, $a
	}
where the compiler substitutes the allocated register (say ECX) for $a. 
  With a little extra syntax to say what sort of register is required, 
we get all the power your vector library needs without adding yet 
another tacked-on feature.  Plus, while you get your vectors, I can get 
my quaternions and matrix manipulation for the same price.

--Joel



More information about the Digitalmars-d mailing list