start on SIMD documentation

deadalnix deadalnix at gmail.com
Sat Jan 14 05:58:16 PST 2012


Le 13/01/2012 09:39, Walter Bright a écrit :
> https://github.com/D-Programming-Language/d-programming-language.org/blob/master/simd.dd
>
>
> and core.simd:
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/simd.d
>

Let me propose something that solve this problem and many other. I never 
had time to explain it properly, but this is definitively interesting 
for this conversation, so I'll give a quick draft.

The idea is to add a new ASM instruction to add an alias to a register 
choosen by the compiler and ensure it represent some existing variable. 
Thus, the compiler could ensure not to use a register already used and 
avoid stack manipulation when possible. This would also help ASM to get 
more readable.

As register are not equal one to another, we need to specify which type 
of register we want to use. For that, we just replace the « variable » 
part of the register name by N. For exemple XMMN is any SSE register. 
RNX represent a general purpose register on x86_64.

Now we define the false alias ASM instruction. Here is a (dumb) exemple :

long toto = 42;
long tata = 1337;

asm {
     alias toto RNX;
     alias tata RNX;
     add toto tata; // Now toto is 1379.
}

If tot and tata are already in some register, the compiler can simply 
map. If they are in memory, the the compiler must choose a register and 
mov the right data into it.


More information about the Digitalmars-d mailing list