Any usable SIMD implementation?

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 1 15:31:00 PDT 2016


On 03/31/2016 10:55 AM, ZombineDev wrote:
> [2]: https://github.com/D-Programming-Language/phobos/pull/2862

Well apparently stores w/ dmd's weird core.simd interface don't work, or
I can't figure out (from the non-existent documentation) how to use it.

---
import core.simd;

void test(float4* ptr, float4 val)
{
    __simd_sto(XMM.STOUPS, *ptr, val);
    __simd(XMM.STOUPS, *ptr, val);
    auto val1 = __simd_sto(XMM.STOUPS, *ptr, val);
    auto val2 = __simd(XMM.STOUPS, *ptr, val);
}
---

LDC at least has some intrinsics once you find ldc.gccbuiltins_x86, but
for some reason comes with it's own broken ldc.simd.loadUnaligned
instead of providing intrinsics.

---
import core.simd, ldc.simd;

float4 test(float* ptr)
{
    return loadUnaligned!float4(ptr);
}
---

/home/dawg/dlang/ldc-0.17.1/bin/../import/ldc/simd.di(212): Error: can't
parse inline LLVM IR:
        %r = load <4 x float>* %p, align 1
                               ^
expected comma after load's type

So are 3 different untested and unused APIs really the current state of
SIMD?

-Martin



More information about the Digitalmars-d mailing list