System programming in D (Was: The God Language)

a a at a.com
Thu Dec 29 14:52:33 PST 2011


Walter Bright Wrote:

> On 12/29/2011 5:13 AM, a wrote:
> > 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.
> 
> This does what you're asking for:
> 
> void test(ref float a, ref float b)
> {
>      asm
>      {
>          naked;
>          movaps  XMM0,[RSI];
>          addps   XMM0,[RDI];
>          movaps  [RSI],XMM0;
>          movaps  XMM0,[RSI];
>          addps   XMM0,[RDI];
>          movaps  [RSI],XMM0;
>          ret;
>      }
> }

What I want is to be able to write short functions using inline assembly and have them inlined and compiled even to a single instruction where possible. This can be done with gcc. See my post here: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=153879


More information about the Digitalmars-d mailing list