I also cannot find any documentation on extractRe() and extractIm(). I googled for "ldc extractre extractim" and there were no results.
Comment #5 by ibuclaw — 2016-11-16T09:38:26Z
I can only think of movshdup/movsldup for extract(), but that doesn't quite do what is being asked.
---
import gcc.builtins;
float4 a = [1,2,3,4];
auto b = __builtin_ia32_movshdup(a); // [1,1,3,3]
auto c = __builtin_ia32_movshdup(a); // [2,2,4,4]
---
Maybe you should provide assembly of what you'd like to be done. But on the surface, it doesn't look like it falls into the category of compiler intrinsics, more like library code.
Comment #6 by ilyayaroshenko — 2016-11-16T10:24:23Z
Looks like a simple wrapper could be put around the PSHUFD instruction.
Comment #8 by turkeyman — 2016-11-20T02:16:59Z
I've wanted to put a SIMD helper library in std for ages. Ie, not intended to present raw arch-specific intrinsics like core.simd, but useful functions typically implemented as small compound operations.
LLVM kinda does this already; it presents SIMD in a fairly abstract high-level way, and codegen's aggressively. We could get a lot of that value from a phobos lib I think.
Comment #9 by ibuclaw — 2016-11-26T22:02:03Z
(In reply to Manu from comment #8)
> I've wanted to put a SIMD helper library in std for ages. Ie, not intended
> to present raw arch-specific intrinsics like core.simd, but useful functions
> typically implemented as small compound operations.
> LLVM kinda does this already; it presents SIMD in a fairly abstract
> high-level way, and codegen's aggressively. We could get a lot of that value
> from a phobos lib I think.
Yeah, two high level abstractions you could expose that should be well understood by compilers are vector permutation/shuffle, and vector conditions.
Comment #10 by robert.schadek — 2024-12-13T18:50:19Z