Skip to content
Guillaume Piolat edited this page Jun 13, 2021 · 12 revisions

Contributing guidelines

Order of intrinsics

Intrinsics should be sorted with the same order as the Intel Intrinsics Guide:

Order of implementation

Intrinsics should always work with all compilers, in x86 32-bit and 64-bit targets. Often, the implementation of intrinsics can be shared between compilers, but often it cannot.

static if(GDC_with_SSE2) // GDC version, guarded by effective use of 
{
    // GDC x86_64 implementation
}
else version(LDC)
{
    // LDC implementation
}
else
{
    // Fallback implementation, 
    // used by DMD and GDC x86 implementation
}
unittest
{
   // Same test for every compiler
}

Testing

All new or touched intrinsics should be covered by unittests.

Finer points

  • Use vec.ptr[ind] = stuff; for assignment of one vector element, as this keeps compatibility with the older GDC found in Travis CI.
  • Using intel-intrinsics should not lead to MMX instructions being generated (as it incurs annoying FPU/MMX transitions). Often, a reasonably fast equivalent exist using higher intruction sets.
  • When you use a builtin, make sure it exist over a large range of existing LDC versions. When it does, do use it though.
Clone this wiki locally