intel-intrinsics 1.0.3

Reuse your C++ SIMD code using Intel intrinsics syntax. Works with LDC.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

intel-intrinsics

The goal is to allow you to use Intel intrinsics in D code.

Why Intel intrinsic syntax? Because it is more familier to C++ programmers and there is a convenient online guide provided by Intel: https://software.intel.com/sites/landingpage/IntrinsicsGuide/

For now only LDC is supported. But be sure to know about the superior SIMD capabilities of LDC exposed in ldc.simd.

Usage


import inteli.xmmintrin; // allows SSE1 intrinsics
import inteli.emmintrin; // allows SSE2 intrinsics

// distance between two points in 4D
float distance(float[4] a, float[4] b) nothrow @nogc
{
    __m128 va = _mm_loadu_ps(a.ptr);
    __m128 vb = _mm_loadu_ps(b.ptr);
    __m128 diffSquared = _mm_sub_ps(va, vb);
    diffSquared = _mm_mul_ps(diffSquared, diffSquared);
    __m128 sum = _mm_add_ps(diffSquared, _mm_srli_si128!8(diffSquared));
    sum = _mm_add_ps(sum, _mm_srli_si128!4(sum));
    return _mm_cvtss_f32(_mm_sqrt_ss(sum));
}
assert(distance([0, 2, 0, 0], [0, 0, 0, 0]) == 2);

Supported instructions set

  • SSE1
  • SSE2
Dependencies:
none
Versions:
1.0.3 2017-Mar-06
1.0.2 2017-Mar-02
1.0.1 2017-Mar-02
1.0.0 2016-Jun-15
~master 2017-Apr-14
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 5 downloads this month

  • 54 downloads total