__simd_sto confusion

Nachtraaf via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 3 07:47:01 PDT 2015


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?


More information about the Digitalmars-d-learn mailing list