core.simd woes

David Nadlinger see at klickverbot.at
Mon Oct 8 16:32:41 PDT 2012


On Monday, 8 October 2012 at 20:23:50 UTC, Iain Buclaw wrote:
> float a = 1, b = 2, c = 3, d = 4;
> float4 f = [a,b,c,d];
>
> ===>
>         movss   -16(%rbp), %xmm0
>         movss   -12(%rbp), %xmm1

The obligatory "me too" post:

LDC turns

---
import core.simd;

struct T {
     float a, b, c, d;
     ubyte[100] passOnStack;
}

void test(T t) {
     receiver([t.a, t.b, t.c, t.d]);
}

void receiver(float4 f);
---

into

---
0000000000000000 <_D4test4testFS4test1TZv>:
    0:   50                      push   rax
    1:   0f 28 44 24 10          movaps xmm0,XMMWORD PTR [rsp+0x10]
    6:   e8 00 00 00 00          call   b 
<_D4test4testFS4test1TZv+0xb>
    b:   58                      pop    rax
    c:   c3                      ret
---

(the struct is just there so that the values are actually on the 
stack, and receiver just so that the optimizer doesn't eat 
everything for breakfast).

David


More information about the Digitalmars-d mailing list