Is it possible to do it now in D out of the box ? I'm using LDC2 compiler if it can help. I'm interested using AVX intrinsics.
3 Answers
At the moment DMD has no AVX intrinsics. Considering that all D compilers use the DMD frontend, and the druntime and phobos, I would say that the only way to do what you want is to use the in-line assembly as suggested by BCS.
I would advise you to check from time to time the core.simd module and see if AVX intrinsics are added.
There is inline ASM. I think DMD supports the SIMD instructions. Not sure what the story for LDC is.
-
Inline ASM is totally impracticable because of register allocation by hand.– elmatticCommented Dec 23, 2012 at 0:30
-
If you don't want asm, then what are you wanting for 'explicit'? Something that's assured to use them? I assume you've checked the intrinsics list? All that's left is the compiler promising to use them on array operations.– BCSCommented Dec 23, 2012 at 5:24
-
By explicit I mean using intrinsics like
_mm256_load_psand declaring__m256variables, etc as you do with gcc or clang. Thank you anyway.– elmatticCommented Dec 23, 2012 at 10:30
With LDC, module ldc.gccbuiltins_x86 contains GCC-style builtins like __builtin_ia32_vfnmaddps256.
(there is also ldc.gccbuiltins_arm, and ldc.gccbuiltins_ppc, ...)