On Monday, 4 September 2017 at 20:39:11 UTC, Igor wrote:
I found that I can't use __simd function from core.simd under LDC and that it has ldc.simd but I couldn't find how to implement equivalent to this with it:

ubyte16* masks = ...;
foreach (ref c; pixels) {
        c = __simd(XMM.PSHUFB, c, *masks);
}

I see it has shufflevector function but it only accepts constant masks and I am using a variable one. Is this possible under LDC?

You can use the module ldc.gccbuiltins_x86.di, __builtin_ia32_pshufb128 and __builtin_ia32_pshufb256.

(also see https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/X86-Built_002din-Functions.html)

Please file a feature request about shufflevector with variable mask in our (LDC) issue tracker on Github; with some code that you'd expect to work. Thanks.

- Johan


Reply via email to