System programming in D (Was: The God Language)

David Nadlinger see at klickverbot.at
Thu Dec 29 08:43:45 PST 2011


On 12/29/11 2:13 PM, a wrote:
> void test(ref V a, ref V b)
> {
>      asm
>      {
>          movaps XMM0, a;
>          addps  XMM0, b;
>          movaps a, XMM0;
>      }
>      asm
>      {
>          movaps XMM0, a;
>          addps  XMM0, b;
>          movaps a, XMM0;
>      }
> }
>
> […]
>
> The needles loads and stores would make it impossible to write an efficient simd add function even if the functions containing asm blocks could be inlined.

Yes, this is indeed a problem, and as far as I'm aware, usually solved 
in the gamedev world by using the (SSE) intrinsics your favorite C++ 
compiler provides, instead of resorting to inline asm.

David


More information about the Digitalmars-d mailing list