VCV Rack API  v1
rack::simd Namespace Reference

Abstraction of byte-aligned values for SIMD CPU acceleration. More...

Classes

struct  Vector
 Generic class for vector types. More...
 
struct  Vector< float, 4 >
 Wrapper for __m128 representing an aligned vector of 4 single-precision float values. More...
 
struct  Vector< int32_t, 4 >
 

Typedefs

typedef Vector< float, 4 > float_4
 
typedef Vector< int32_t, 4 > int32_4
 

Functions

float ifelse (bool cond, float a, float b)
 
float_4 ifelse (float_4 mask, float_4 a, float_4 b)
 Given a mask, returns a if mask is 0xffffffff per element, b if mask is 0x00000000. More...
 
float_4 rsqrt (float_4 x)
 Returns the approximate reciprocal square root. More...
 
float_4 rcp (float_4 x)
 Returns the approximate reciprocal. More...
 
template<typename T >
movemaskInverse (int a)
 Given a mask a, returns a vector with each element either 0's or 1's depending on the mask bit. More...
 
template<>
float_4 movemaskInverse< float_4 > (int x)
 
float_4 fmax (float_4 x, float_4 b)
 
float_4 fmin (float_4 x, float_4 b)
 
float_4 sqrt (float_4 x)
 
float_4 log (float_4 x)
 
float_4 log10 (float_4 x)
 
float_4 log2 (float_4 x)
 
float_4 exp (float_4 x)
 
float_4 sin (float_4 x)
 
float_4 cos (float_4 x)
 
float_4 tan (float_4 x)
 
float_4 atan (float_4 x)
 
float_4 atan2 (float_4 x, float_4 y)
 
float_4 trunc (float_4 a)
 
float_4 floor (float_4 a)
 
float_4 ceil (float_4 a)
 
float_4 round (float_4 a)
 
float_4 fmod (float_4 a, float_4 b)
 
float_4 hypot (float_4 a, float_4 b)
 
float_4 fabs (float_4 a)
 
float_4 abs (float_4 a)
 
float_4 abs (std::complex< float_4 > a)
 
float_4 arg (std::complex< float_4 > a)
 
float_4 pow (float_4 a, float_4 b)
 
float_4 pow (float a, float_4 b)
 
template<typename T >
pow (T a, int b)
 
float_4 clamp (float_4 x, float_4 a, float_4 b)
 
float_4 rescale (float_4 x, float_4 xMin, float_4 xMax, float_4 yMin, float_4 yMax)
 
float_4 crossfade (float_4 a, float_4 b, float_4 p)
 
float_4 sgn (float_4 x)
 
Vector< float, 4 > andnot (const Vector< float, 4 > &a, const Vector< float, 4 > &b)
 ~a & b More...
 
int movemask (const Vector< float, 4 > &a)
 Returns an integer with each bit corresponding to the most significant bit of each element. More...
 
int movemask (const Vector< int32_t, 4 > &a)
 Returns an integer with each bit corresponding to the most significant bit of each byte. More...
 
Vector< int32_t, 4 > operator>= (const Vector< int32_t, 4 > &a, const Vector< int32_t, 4 > &b)
 
Vector< int32_t, 4 > operator<= (const Vector< int32_t, 4 > &a, const Vector< int32_t, 4 > &b)
 
Vector< int32_t, 4 > operator!= (const Vector< int32_t, 4 > &a, const Vector< int32_t, 4 > &b)
 
Vector< float, 4 > operator+ (const Vector< float, 4 > &a)
 +a More...
 
Vector< int32_t, 4 > operator+ (const Vector< int32_t, 4 > &a)
 
Vector< float, 4 > operator- (const Vector< float, 4 > &a)
 -a More...
 
Vector< int32_t, 4 > operator- (const Vector< int32_t, 4 > &a)
 
Vector< float, 4 > & operator++ (Vector< float, 4 > &a)
 ++a More...
 
Vector< int32_t, 4 > & operator++ (Vector< int32_t, 4 > &a)
 
Vector< float, 4 > & operator-- (Vector< float, 4 > &a)
 --a More...
 
Vector< int32_t, 4 > & operator-- (Vector< int32_t, 4 > &a)
 
Vector< float, 4 > operator++ (Vector< float, 4 > &a, int)
 a++ More...
 
Vector< int32_t, 4 > operator++ (Vector< int32_t, 4 > &a, int)
 
Vector< float, 4 > operator-- (Vector< float, 4 > &a, int)
 a-- More...
 
Vector< int32_t, 4 > operator-- (Vector< int32_t, 4 > &a, int)
 
Vector< float, 4 > operator~ (const Vector< float, 4 > &a)
 ~a More...
 
Vector< int32_t, 4 > operator~ (const Vector< int32_t, 4 > &a)
 
Vector< int32_t, 4 > operator<< (const Vector< int32_t, 4 > &a, const int &b)
 a << b More...
 
Vector< int32_t, 4 > operator>> (const Vector< int32_t, 4 > &a, const int &b)
 a >> b More...
 

Detailed Description

Abstraction of byte-aligned values for SIMD CPU acceleration.

Typedef Documentation

◆ float_4

typedef Vector<float, 4> rack::simd::float_4

◆ int32_4

typedef Vector<int32_t, 4> rack::simd::int32_4

Function Documentation

◆ ifelse() [1/2]

float rack::simd::ifelse ( bool  cond,
float  a,
float  b 
)
inline

◆ ifelse() [2/2]

float_4 rack::simd::ifelse ( float_4  mask,
float_4  a,
float_4  b 
)
inline

Given a mask, returns a if mask is 0xffffffff per element, b if mask is 0x00000000.

◆ rsqrt()

float_4 rack::simd::rsqrt ( float_4  x)
inline

Returns the approximate reciprocal square root.

Much faster than 1/sqrt(x).

◆ rcp()

float_4 rack::simd::rcp ( float_4  x)
inline

Returns the approximate reciprocal.

Much faster than 1/x.

◆ movemaskInverse()

template<typename T >
T rack::simd::movemaskInverse ( int  a)

Given a mask a, returns a vector with each element either 0's or 1's depending on the mask bit.

◆ movemaskInverse< float_4 >()

template<>
float_4 rack::simd::movemaskInverse< float_4 > ( int  x)
inline

◆ fmax()

float_4 rack::simd::fmax ( float_4  x,
float_4  b 
)
inline

◆ fmin()

float_4 rack::simd::fmin ( float_4  x,
float_4  b 
)
inline

◆ sqrt()

float_4 rack::simd::sqrt ( float_4  x)
inline

◆ log()

float_4 rack::simd::log ( float_4  x)
inline

◆ log10()

float_4 rack::simd::log10 ( float_4  x)
inline

◆ log2()

float_4 rack::simd::log2 ( float_4  x)
inline

◆ exp()

float_4 rack::simd::exp ( float_4  x)
inline

◆ sin()

float_4 rack::simd::sin ( float_4  x)
inline

◆ cos()

float_4 rack::simd::cos ( float_4  x)
inline

◆ tan()

float_4 rack::simd::tan ( float_4  x)
inline

◆ atan()

float_4 rack::simd::atan ( float_4  x)
inline

◆ atan2()

float_4 rack::simd::atan2 ( float_4  x,
float_4  y 
)
inline

◆ trunc()

float_4 rack::simd::trunc ( float_4  a)
inline

◆ floor()

float_4 rack::simd::floor ( float_4  a)
inline

◆ ceil()

float_4 rack::simd::ceil ( float_4  a)
inline

◆ round()

float_4 rack::simd::round ( float_4  a)
inline

◆ fmod()

float_4 rack::simd::fmod ( float_4  a,
float_4  b 
)
inline

◆ hypot()

float_4 rack::simd::hypot ( float_4  a,
float_4  b 
)
inline

◆ fabs()

float_4 rack::simd::fabs ( float_4  a)
inline

◆ abs() [1/2]

float_4 rack::simd::abs ( float_4  a)
inline

◆ abs() [2/2]

float_4 rack::simd::abs ( std::complex< float_4 a)
inline

◆ arg()

float_4 rack::simd::arg ( std::complex< float_4 a)
inline

◆ pow() [1/3]

float_4 rack::simd::pow ( float_4  a,
float_4  b 
)
inline

◆ pow() [2/3]

float_4 rack::simd::pow ( float  a,
float_4  b 
)
inline

◆ pow() [3/3]

template<typename T >
T rack::simd::pow ( a,
int  b 
)

◆ clamp()

float_4 rack::simd::clamp ( float_4  x,
float_4  a,
float_4  b 
)
inline

◆ rescale()

float_4 rack::simd::rescale ( float_4  x,
float_4  xMin,
float_4  xMax,
float_4  yMin,
float_4  yMax 
)
inline

◆ crossfade()

float_4 rack::simd::crossfade ( float_4  a,
float_4  b,
float_4  p 
)
inline

◆ sgn()

float_4 rack::simd::sgn ( float_4  x)
inline

◆ andnot()

Vector<float, 4> rack::simd::andnot ( const Vector< float, 4 > &  a,
const Vector< float, 4 > &  b 
)
inline

~a & b

◆ movemask() [1/2]

int rack::simd::movemask ( const Vector< float, 4 > &  a)
inline

Returns an integer with each bit corresponding to the most significant bit of each element.

For example, movemask(float_4::mask()) returns 0xf.

◆ movemask() [2/2]

int rack::simd::movemask ( const Vector< int32_t, 4 > &  a)
inline

Returns an integer with each bit corresponding to the most significant bit of each byte.

For example, movemask(int32_4::mask()) returns 0xffff.

◆ operator>=()

Vector<int32_t, 4> rack::simd::operator>= ( const Vector< int32_t, 4 > &  a,
const Vector< int32_t, 4 > &  b 
)
inline

◆ operator<=()

Vector<int32_t, 4> rack::simd::operator<= ( const Vector< int32_t, 4 > &  a,
const Vector< int32_t, 4 > &  b 
)
inline

◆ operator!=()

Vector<int32_t, 4> rack::simd::operator!= ( const Vector< int32_t, 4 > &  a,
const Vector< int32_t, 4 > &  b 
)
inline

◆ operator+() [1/2]

Vector<float, 4> rack::simd::operator+ ( const Vector< float, 4 > &  a)
inline

+a

◆ operator+() [2/2]

Vector<int32_t, 4> rack::simd::operator+ ( const Vector< int32_t, 4 > &  a)
inline

◆ operator-() [1/2]

Vector<float, 4> rack::simd::operator- ( const Vector< float, 4 > &  a)
inline

-a

◆ operator-() [2/2]

Vector<int32_t, 4> rack::simd::operator- ( const Vector< int32_t, 4 > &  a)
inline

◆ operator++() [1/4]

Vector<float, 4>& rack::simd::operator++ ( Vector< float, 4 > &  a)
inline

++a

◆ operator++() [2/4]

Vector<int32_t, 4>& rack::simd::operator++ ( Vector< int32_t, 4 > &  a)
inline

◆ operator--() [1/4]

Vector<float, 4>& rack::simd::operator-- ( Vector< float, 4 > &  a)
inline

--a

◆ operator--() [2/4]

Vector<int32_t, 4>& rack::simd::operator-- ( Vector< int32_t, 4 > &  a)
inline

◆ operator++() [3/4]

Vector<float, 4> rack::simd::operator++ ( Vector< float, 4 > &  a,
int   
)
inline

a++

◆ operator++() [4/4]

Vector<int32_t, 4> rack::simd::operator++ ( Vector< int32_t, 4 > &  a,
int   
)
inline

◆ operator--() [3/4]

Vector<float, 4> rack::simd::operator-- ( Vector< float, 4 > &  a,
int   
)
inline

a--

◆ operator--() [4/4]

Vector<int32_t, 4> rack::simd::operator-- ( Vector< int32_t, 4 > &  a,
int   
)
inline

◆ operator~() [1/2]

Vector<float, 4> rack::simd::operator~ ( const Vector< float, 4 > &  a)
inline

~a

◆ operator~() [2/2]

Vector<int32_t, 4> rack::simd::operator~ ( const Vector< int32_t, 4 > &  a)
inline

◆ operator<<()

Vector<int32_t, 4> rack::simd::operator<< ( const Vector< int32_t, 4 > &  a,
const int &  b 
)
inline

a << b

◆ operator>>()

Vector<int32_t, 4> rack::simd::operator>> ( const Vector< int32_t, 4 > &  a,
const int &  b 
)
inline

a >> b