Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 08, 2014 How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
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? |
October 08, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | 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
|
October 08, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | 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. If
I 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?
|
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | Am 08.10.2014 21:12, schrieb Etienne:
> 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. If
>
> I 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?
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 Thaut
|
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | 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 Thaut
Any idea where I can find the headers in D for it?
|
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | Am 09.10.2014 21:04, schrieb Etienne: > 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 Thaut > > Any idea where I can find the headers in D for it? 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 Thaut |
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | 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
|
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | 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.d That'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 ! |
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 2014-10-09 5:05 PM, David Nadlinger wrote:
> 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
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 :-p
|
October 09, 2014 Re: How do I write __simd(void16*, void16) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | 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? |
Copyright © 1999-2021 by the D Language Foundation