D perfomance

Walter Bright newshound2 at digitalmars.com
Sun Apr 26 01:45:53 UTC 2020


On 4/24/2020 8:06 PM, SrMordred wrote:
> Also u can achieve the same asm with @llvmAttr("noalias") in front of at least 
> one argument.

The following C code:

int test(int * __restrict__ x, int * __restrict__ y) {
     *x = 0;
     *y = 1;
     return *x;
}

compiled with gcc -O:

test:
                 mov     dword ptr [RDI],0
                 mov     dword ptr [RSI],1
                 mov     EAX,0
                 ret

It's not a unique property of Rust, C99 has it too. DMC doesn't implement it, 
but it probably should.


More information about the Digitalmars-d mailing list