On Saturday, 3 October 2015 at 14:47:02 UTC, Nachtraaf wrote:
I'm trying to create some linear algebra functions using simd
intrinsics. I watched the dconf 2013 presentation by Manu Evans
but i'm still confused about some aspects and the following
piece of code doesn't work. I'm trying to copy the result of a
dot product from the register to memory but dmd fails with an
overload resolution error, which i guess is due some implicit
conversion?
dmd error:
simd1.d(34): Error: core.simd.__simd_sto called with argument
types (XMM, float, __vector(float[4])) matches both:
/usr/include/dlang/dmd/core/simd.d(434):
core.simd.__simd_sto(XMM opcode, double op1, __vector(void[16])
op2)
and:
/usr/include/dlang/dmd/core/simd.d(435):
core.simd.__simd_sto(XMM opcode, float op1, __vector(void[16])
op2)
from the following piece of code:
float dot_simd1(float4 a, float4 b)
{
float4 result = __simd(XMM.DPPS, a, b, 0xFF);
float value;
__simd_sto(XMM.STOSS, value, result);
return value;
}
What am I doing wrong here?
core.simd is horribly broken. I recommend that you avoid it for
any serious work. If you want to do simd programming with D get
LDC or GDC and use their simd intrinsics instead of core.simd.
If you have to do simd with dmd write inline assembly.