LDC 0.11.0 has been released!
bearophile
bearophileHUGS at lycos.com
Tue Aug 6 08:24:40 PDT 2013
import core.simd;
float bar1(float4 data) pure nothrow {
return data.array[0];
}
struct Foo {
float4 data;
alias data this;
}
float bar2(Foo data) pure nothrow {
return data.array[0];
}
void main() {
float4 f = [1.5, 2.5, 3.5, 4.5];
bar1(f);
bar2(Foo(f));
}
Produces this asm for the bar1 and bar2 functions:
__D4test4bar1FNaNbNhG4fZf:
pushl %eax
vmovss %xmm0, (%esp)
flds (%esp)
popl %eax
ret
__D4test4bar2FNaNbS4test3FooZf:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $16, %esp
flds 8(%ebp)
movl %ebp, %esp
popl %ebp
ret $16
Is that good enough?
Bye,
bearophile
More information about the digitalmars-d-ldc
mailing list