digitalmars.D.learn - How do I write __simd(void16*, void16) ?
- Etienne (6/6) Oct 08 2014 I can't seem to find this function anywhere: __simd(void16*, void16)
- Benjamin Thaut (11/17) Oct 08 2014 I strongly advise to not use core.simd at this point. It is in a
- Etienne (4/6) Oct 08 2014 I think I'll have to re-write the xmmintrin.h functions I need as string...
- Benjamin Thaut (8/14) Oct 09 2014 I know that GDC stopped supporting D style inline asm a while ago. If
- Etienne (2/9) Oct 09 2014 Any idea where I can find the headers in D for it?
- Benjamin Thaut (15/25) Oct 09 2014 I think a good starting point would be Manu's std.simd module. I don't
- David Nadlinger (5/8) Oct 09 2014 By the way, LDC has ldc.gccbuiltins_x86 too. LLVM doesn't export
- Etienne (4/12) Oct 09 2014 That's very helpful, the problem remains that the API is unfamiliar. I
- Etienne Cimon (8/11) Oct 09 2014 Sorry, I think I had a bad understanding. I found out through a github
- Etienne (4/14) Oct 09 2014 That's a great reference! I can do a lot from that. I wish it wasn't an
- ketmar via Digitalmars-d-learn (15/19) Oct 10 2014 On Thu, 09 Oct 2014 17:19:05 -0400
- Etienne (5/8) Oct 10 2014 Hi ketmar,
- ketmar via Digitalmars-d-learn (13/16) Oct 10 2014 On Fri, 10 Oct 2014 08:31:44 -0400
- Etienne (2/11) Oct 10 2014 Nice! Nobody knows simd but they all know how to make it work. Go figure...
- ketmar via Digitalmars-d-learn (5/19) Oct 10 2014 On Fri, 10 Oct 2014 09:09:09 -0400
- Trass3r (3/7) Oct 09 2014 Is there a module by now that allows to directly write Intel
I can't seem to find this function anywhere: __simd(void16*, void16) The mangling seems to go through to dmd's glue.lib This is for SSE2 operations: MOVDQU => void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU => __m128i _mm_loadu_si128 ( __m128i *p) Would I have to write this with ASM?
Oct 08 2014
Am 08.10.2014 20:56, schrieb Etienne:I can't seem to find this function anywhere: __simd(void16*, void16) The mangling seems to go through to dmd's glue.lib This is for SSE2 operations: MOVDQU => void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU => __m128i _mm_loadu_si128 ( __m128i *p) Would I have to write this with ASM?I strongly advise to not use core.simd at this point. It is in a horribly broken state and generates code that is far from efficient. If you use core.simd your code will be slower then if you use normal floating point math. Also afaik core.simd is currently only supported by dmd meaning that yuo have to rewrite the code in case you want to go to ldc or gdc. If you need simd with dmd, write inline assembly. If you need simd with the other two compilers, use the gcc intrinsics, they work on both compilers. Kind Regards Benjamin Thaut
Oct 08 2014
On 2014-10-08 3:04 PM, Benjamin Thaut wrote:I strongly advise to not use core.simd at this point. It is in a horribly broken state and generates code that is far from efficient. IfI think I'll have to re-write the xmmintrin.h functions I need as string mixins to inline the assembly. Is that supposed to be compatible with LDC/GDC anyways?
Oct 08 2014
Am 08.10.2014 21:12, schrieb Etienne:On 2014-10-08 3:04 PM, Benjamin Thaut wrote:I know that GDC stopped supporting D style inline asm a while ago. If you need inline asm with GDC you have to use the gcc style inline assembly. I don't know about ldc though. But generally you want to use the official intrinsics with gdc and ldc because they won't perform any optimizations on inline assembly. Kind Regards Benjamin ThautI strongly advise to not use core.simd at this point. It is in a horribly broken state and generates code that is far from efficient. IfI think I'll have to re-write the xmmintrin.h functions I need as string mixins to inline the assembly. Is that supposed to be compatible with LDC/GDC anyways?
Oct 09 2014
On 2014-10-09 2:32 PM, Benjamin Thaut wrote:I know that GDC stopped supporting D style inline asm a while ago. If you need inline asm with GDC you have to use the gcc style inline assembly. I don't know about ldc though. But generally you want to use the official intrinsics with gdc and ldc because they won't perform any optimizations on inline assembly. Kind Regards Benjamin ThautAny idea where I can find the headers in D for it?
Oct 09 2014
Am 09.10.2014 21:04, schrieb Etienne:On 2014-10-09 2:32 PM, Benjamin Thaut wrote:I think a good starting point would be Manu's std.simd module. I don't know if he is still working on it, but a old version can be found here: https://github.com/TurkeyMan/simd/blob/master/std/simd.d If you have further questions you might be well advised to ask him: turkeyman gmail.com You can also find the druntime versions of ldc and gdc on github. For example: https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/simd.di https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/builtins.d Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module. Kind Regards Benjamin ThautI know that GDC stopped supporting D style inline asm a while ago. If you need inline asm with GDC you have to use the gcc style inline assembly. I don't know about ldc though. But generally you want to use the official intrinsics with gdc and ldc because they won't perform any optimizations on inline assembly. Kind Regards Benjamin ThautAny idea where I can find the headers in D for it?
Oct 09 2014
On Thursday, 9 October 2014 at 20:29:44 UTC, Benjamin Thaut wrote:Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module.By the way, LDC has ldc.gccbuiltins_x86 too. LLVM doesn't export all the GCC-style intrinsics, though, if they are easily representable in normal LLVM IR (thus ldc.simd). Daivd
Oct 09 2014
On 2014-10-09 5:05 PM, David Nadlinger wrote:On Thursday, 9 October 2014 at 20:29:44 UTC, Benjamin Thaut wrote:That's very helpful, the problem remains that the API is unfamiliar. I think most of the time, simd code will only need to be translated from basic function calls, it would've been nice to have equivalents :-pUnforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module.By the way, LDC has ldc.gccbuiltins_x86 too. LLVM doesn't export all the GCC-style intrinsics, though, if they are easily representable in normal LLVM IR (thus ldc.simd). Daivd
Oct 09 2014
On 2014-10-09 17:32, Etienne wrote:That's very helpful, the problem remains that the API is unfamiliar. I think most of the time, simd code will only need to be translated from basic function calls, it would've been nice to have equivalents :-pSorry, I think I had a bad understanding. I found out through a github issue that you need to use pragma(LDC_intrinsic, "llvm.*") [function declaration] https://github.com/ldc-developers/ldc/issues/627 And the possible gcc-style intrinsics are defined here: https://www.opensource.apple.com/source/clamav/clamav-158/clamav.Bin/clamav-0.98/libclamav/c++/llvm/include/llvm/Intrinsics.gen This really begs for at binding hat works with all compilers.
Oct 09 2014
On 2014-10-09 4:29 PM, Benjamin Thaut wrote:I think a good starting point would be Manu's std.simd module. I don't know if he is still working on it, but a old version can be found here: https://github.com/TurkeyMan/simd/blob/master/std/simd.dThat's a great reference! I can do a lot from that. I wish it wasn't an EDSL, makes it really hard to translate the simd code to D.You can also find the druntime versions of ldc and gdc on github. For example: https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/simd.di https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/builtins.d Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module.OK, thanks !
Oct 09 2014
On Thu, 09 Oct 2014 17:19:05 -0400 Etienne via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:why, ketmar to the rescue! gcc.builtins is empty module. ;-) actually, importing it works like a trigger, and then programmer has access to GCC builtins defined in GCC source. one can read GCC documentation to find more information about 'em. also, importing this module defines some types. here they are: __builtin_va_list The target's va_list type )) __builtin_clong The D equivalent of the target's C "long" type __builtin_culong The D equivalent of the target's C "unsigned long" __builtin_machine_int Signed word-sized integer __builtin_machine_uint Unsigned word-sized integer __builtin_pointer_int Signed pointer-sized integer __builtin_pointer_uint Unsigned pointer-sized integerUnforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module.OK, thanks !
Oct 10 2014
On 2014-10-10 4:12 AM, ketmar via Digitalmars-d-learn wrote:actually, importing it works like a trigger, and then programmer has access to GCC builtins defined in GCC source. one can read GCC documentation to find more information about 'em.Hi ketmar, Which type would have to be sent to the corresponding functions? I have a hard time figuring out how to use the __m128i with the proper mangling. Does it use core.simd's Vector!x types there?
Oct 10 2014
On Fri, 10 Oct 2014 08:31:44 -0400 Etienne via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Which type would have to be sent to the corresponding functions? I have a hard time figuring out how to use the __m128i with the proper=20 mangling. Does it use core.simd's Vector!x types there?i know nothing about SIMD, but this compiles: import core.simd; import gcc.builtins; void main () { float4 a, b; auto tmp =3D __builtin_ia32_mulps(a, b); // a*b } i don't know what the hell this means, but at least it accepts types from core.simd. ;-) so i assume that other such builtins will accept other types too.
Oct 10 2014
On 2014-10-10 9:01 AM, ketmar via Digitalmars-d-learn wrote:import core.simd; import gcc.builtins; void main () { float4 a, b; auto tmp = __builtin_ia32_mulps(a, b); // a*b } i don't know what the hell this means, but at least it accepts types from core.simd. ;-) so i assume that other such builtins will accept other types too.Nice! Nobody knows simd but they all know how to make it work. Go figure =)
Oct 10 2014
On Fri, 10 Oct 2014 09:09:09 -0400 Etienne via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:On 2014-10-10 9:01 AM, ketmar via Digitalmars-d-learn wrote:btw, i'm ready to do tests with 32-bit gdc if necessary. you can mail/jabber me (the address is the same ;-) if you need.import core.simd; import gcc.builtins; void main () { float4 a, b; auto tmp =3D __builtin_ia32_mulps(a, b); // a*b } i don't know what the hell this means, but at least it accepts types from core.simd. ;-) so i assume that other such builtins will accept other types too.=20 Nice! Nobody knows simd but they all know how to make it work. Go figure =3D)
Oct 10 2014
On Wednesday, 8 October 2014 at 18:56:31 UTC, Etienne wrote:I can't seem to find this function anywhere: __simd(void16*, void16)MOVDQU => void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU => __m128i _mm_loadu_si128 ( __m128i *p)Is there a module by now that allows to directly write Intel intrinsics?
Oct 09 2014