digitalmars.D.ldc - Using AVX intrinsics with LDC
- Jeff (12/12) May 15 2018 Hello,
- kinke (13/25) May 15 2018 Hi, you'll want to have a look at LDC's
- Kagamin (3/4) May 16 2018 If it zero extends 64-bit integer to 128-bit integer, it's done
- kinke (3/7) May 16 2018 That's enough indeed: https://run.dlang.io/is/1wJ7mA
- Jeff (3/12) May 16 2018 Thanks, it works perfectly ! Also I discover run.dlang.io, nice
- Johan Engelen (4/6) May 16 2018 You might like https://d.godbolt.org better if you don't need to
- Guillaume Piolat (4/16) May 23 2018 I've started doing such a translation as a library here:
Hello, I'm a beginner in D (I come from C++/Python), but I'm having great fun learning the language reading Ali's book. I'm using LDC as compiler, and I would like to use intrinsics, but I have difficulties to find the Intel intrinsics equivalent. Here are the functions I'm looking for : _mm_cvtsi64x_si128 _mm256_sll_epi64 _mm256_movemask_epi8 Is there a way to call them ? Is there an Intel intrinsics to LDC intrinsics guide somewhere ? Thanks for your help !
May 15 2018
On Tuesday, 15 May 2018 at 17:21:49 UTC, Jeff wrote:Hello, I'm a beginner in D (I come from C++/Python), but I'm having great fun learning the language reading Ali's book. I'm using LDC as compiler, and I would like to use intrinsics, but I have difficulties to find the Intel intrinsics equivalent. Here are the functions I'm looking for : _mm_cvtsi64x_si128 _mm256_sll_epi64 _mm256_movemask_epi8 Is there a way to call them ? Is there an Intel intrinsics to LDC intrinsics guide somewhere ? Thanks for your help !Hi, you'll want to have a look at LDC's `import/ldc/gccbuiltins_x86.di` file (auto-generated from corresponding LLVM x86 intrinsics). Make sure to enable extended instruction sets via something like `-mattr=+avx2` (or simply `-mcpu=native`). _mm256_movemask_epi8 => __builtin_ia32_pmovmskb256 _mm256_sll_epi64 => __builtin_ia32_psllqi256 I didn't find the corresponding declaration for _mm_cvtsi64x_si128 (__builtin_ia32_vzeroupper strangely takes no args). You can always resort to LLVM assembly though (grep for `__asm` in import directory to see some examples in druntime/Phobos).
May 15 2018
On Tuesday, 15 May 2018 at 17:21:49 UTC, Jeff wrote:_mm_cvtsi64x_si128If it zero extends 64-bit integer to 128-bit integer, it's done by movq instruction. I suppose simple assignment should do it.
May 16 2018
On Wednesday, 16 May 2018 at 10:36:01 UTC, Kagamin wrote:On Tuesday, 15 May 2018 at 17:21:49 UTC, Jeff wrote:That's enough indeed: https://run.dlang.io/is/1wJ7mA [And vzeroupper is unrelated, and no args are correct.]_mm_cvtsi64x_si128If it zero extends 64-bit integer to 128-bit integer, it's done by movq instruction. I suppose simple assignment should do it.
May 16 2018
On Wednesday, 16 May 2018 at 13:11:46 UTC, kinke wrote:On Wednesday, 16 May 2018 at 10:36:01 UTC, Kagamin wrote:Thanks, it works perfectly ! Also I discover run.dlang.io, nice to quickly check the ASM output :)On Tuesday, 15 May 2018 at 17:21:49 UTC, Jeff wrote:That's enough indeed: https://run.dlang.io/is/1wJ7mA [And vzeroupper is unrelated, and no args are correct.]_mm_cvtsi64x_si128If it zero extends 64-bit integer to 128-bit integer, it's done by movq instruction. I suppose simple assignment should do it.
May 16 2018
On Wednesday, 16 May 2018 at 19:34:32 UTC, Jeff wrote:Also I discover run.dlang.io, nice to quickly check the ASM output :)You might like https://d.godbolt.org better if you don't need to execute the code. -Johan
May 16 2018
On Tuesday, 15 May 2018 at 17:21:49 UTC, Jeff wrote:Hello, I'm a beginner in D (I come from C++/Python), but I'm having great fun learning the language reading Ali's book. I'm using LDC as compiler, and I would like to use intrinsics, but I have difficulties to find the Intel intrinsics equivalent. Here are the functions I'm looking for : _mm_cvtsi64x_si128 _mm256_sll_epi64 _mm256_movemask_epi8 Is there a way to call them ? Is there an Intel intrinsics to LDC intrinsics guide somewhere ? Thanks for your help !I've started doing such a translation as a library here: http://code.dlang.org/packages/intel-intrinsics However, no AVX yet
May 23 2018