intel-intrinsics 1.0.0

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


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

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.11.21 2024-Oct-26
1.11.20 2024-Aug-13
1.11.19 2024-Jul-21
1.11.18 2024-Jan-03
1.11.17 2023-Dec-17
Show all 111 versions
Download Stats:
  • 7 downloads today

  • 71 downloads this week

  • 211 downloads this month

  • 119332 downloads total

Score:
3.6
Short URL:
intel-intrinsics.dub.pm