On Sat, Nov 7, 2009 at 8:49 AM, Christian Kamm <[email protected]> wrote: > On Saturday 07 November 2009 00:06 Mike Farnsworth wrote: >> What support, if any, does ldc have for SSE intrinsics, such as those >> found in the gcc/vc++/etc headers *mmintrin.h ? The llvm gcc frontend >> supports them, and I believe clang does as well. I could only find a >> few pragmas for llvm intrinsics in the ldc part of the std lib. >> >> If this is something that could (relatively) easily be added, let me >> know what to do and I'll see if I can muster up a patch sometime. It >> may also be that there needs to be a little extra knowledge about some >> __m128- and __m64-like types in order to have the llvm backend >> actually prefer putting them in SSE registers? > > Hi Mike, > > LDC can bind LLVM intrinsics to D functions if their signature is expressable > in D. Like for memcpy: > > pragma(intrinsic, "llvm.memcpy.i32") > void llvm_memcpy_i32(void* dst, void* src, uint len, uint alignment); > > As far as I remember, the problem with the SSE intrinsics is that there's no D > type that matches llvm's vector types > (http://www.llvm.org/docs/LangRef.html#t_vector). And that means getting > explicit access to the intrinsic from D code will not be easy. > > I think Tomas looked into this at some point, maybe he can offer some advice > to get you started. > > Note that the LLVM optimizer should already make use of the intrinsics. > > Regards, > Christian >
The problem was indeed introducing the vector types into the D type system. Fixed-size array seems like a perfect fit, but in D1 they are treated as reference types (and are not returnable). I never found the best way to go about it... and adding a completely new type into the frontend seemed like a lot of work Tomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "LDC - the LLVM D compiler" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ldc-dev?hl=en -~----------~----~----~----~------~----~------~--~---
