Generic SIMD Intrinsic Library API  0.6
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
generic::svec< 4, float > Struct Template Reference

data representation and operations on a vector of 4 float. More...

#include <generic4.h>

Public Member Functions

 svec ()
 Default constructor. More...
 
 svec (float a, float b, float c, float d)
 Constructor. More...
 
 svec (float a)
 Constructor. More...
 
float & operator[] (int index)
 operator [] to set or get the vector element specified by index. More...
 
const float operator[] (int index) const
 
svec< 4,bool > operator== (svec< 4, float > a)
 Element-wise compare equal, return a bool vector, e.g., "a == b" *. More...
 
svec< 4,bool > operator!= (svec< 4, float > a)
 Element-wise compare not equal, return a bool vector. E.g. "a != b" *. More...
 
svec< 4,bool > operator< (svec< 4, float > a)
 Element-wise compare less than, return a bool vector. E.g. "a < b" *. More...
 
svec< 4,bool > operator<= (svec< 4, float > a)
 Element-wise compare less equal, return a bool vector. E.g. "a <= b" *. More...
 
svec< 4,bool > operator> (svec< 4, float > a)
 Element-wise compare greater than, return a bool vector. E.g. "a > b" *. More...
 
svec< 4,bool > operator>= (svec< 4, float > a)
 Element-wise compare greater equal, return a bool vector. E.g. "a >= b" *. More...
 
svec< 4, float > operator- ()
 get the neg value, return a VTYPE vector. E.g. "-a" More...
 
float reduce_add ()
 Get the sum of all the element values in the vector. return a float scalar. More...
 
float reduce_max ()
 Get the max value of all the element values in the vector. return a float scalar. More...
 
float reduce_min ()
 Get the min value of all the element values in the vector. return a float scalar. More...
 
svec< 4, float > operator+ (svec< 4, float > a)
 Add two vectors. More...
 
svec< 4, float > operator+ (float s)
 Add a vector and a scalar. More...
 
svec< 4, float > operator- (svec< 4, float > a)
 Sub two vectors. More...
 
svec< 4, float > operator- (float s)
 Sub a vector and a scalar. More...
 
svec< 4, float > operator* (svec< 4, float > a)
 Multiply two vectors. More...
 
svec< 4, float > operator* (float s)
 Multiply a vector and a scalar. More...
 
svec< 4, float > operator/ (svec< 4, float > a)
 Divide a vector by a vector. More...
 
svec< 4, float > operator/ (float s)
 Divide a vector by a scalar. More...
 
void store (svec< 4, float > *p)
 Store the vector to address p. More...
 
void masked_store (svec< 4, float > *p, svec< 4, bool > mask)
 Store the vector element's value to pointer p if the mask element is true. More...
 
void scatter (svec< 4, void * > ptrs, svec< 4, bool > mask)
 Scatter the vector's elements to the locations pointed by the vector ptrs if the mask element is true. More...
 
void scatter_base_offsets (float *b, uint32_t scale, svec< 4, int32_t > offsets, svec< 4, bool > mask)
 Scatter the vector's elements to the addresses ((char*)b + scale * offsets) if the mask element is true. More...
 
void scatter_base_offsets (float *b, uint32_t scale, svec< 4, int64_t > offsets, svec< 4, bool > mask)
 Scatter the vector's elements to the addresses ((char*)b + scale * offsets) if the mask element is true. More...
 
void scatter_stride (float *b, int32_t off, int32_t stride)
 Scatter the vector's elements to the addresses (b+off, b++off+stride, b+off+2*stride, b+off+3*step). More...
 
void scatter_stride (float *b, int64_t off, int64_t stride)
 Scatter the vector's elements to the addresses (b+off, b++off+stride, b+off+2*stride, b+off+3*step). More...
 
svec< 4, float > broadcast (int32_t index)
 Return a new vector by setting all the elements of the new vector with this vector's index element. More...
 
svec< 4, float > rotate (int32_t index)
 Return a new vector by rotate this vector's elements. e.g. newVec[i] = thisVec[i+index]. More...
 
svec< 4, float > shuffle (svec< 4, int32_t > index)
 Return a new vector by shuffle this vector's elements with index vector e.g. newVec[i] = thisVec[index[i]]. More...
 
svec< 4, float > abs ()
 Return a new vector of the vector's abs value. More...
 
svec< 4, float > round ()
 return the round VTYPE vector. More...
 
svec< 4, float > floor ()
 return the floor VTYPE vector. More...
 
svec< 4, float > ceil ()
 return the ceil VTYPE vector. More...
 
svec< 4, float > sqrt ()
 return the sqrt VTYPE vector. More...
 
svec< 4, float > rcp ()
 return the reverse VTYPE vector. (1.0/thisVec) More...
 
svec< 4, float > rsqrt ()
 return the reverse sqrt VTYPE vector. ( 1.0/sqrt(thisVec) ) More...
 
svec< 4, float > exp ()
 return the exp VTYPE vector. More...
 
svec< 4, float > log ()
 return the log VTYPE vector. More...
 
svec< 4, float > pow (svec< 4, float > a)
 return the pow VTYPE vector. More...
 

Static Public Member Functions

static svec< 4, float > load (svec< 4, float > *p)
 load the vector from the pointer p More...
 
static svec< 4, float > masked_load (svec< 4, float > *p, svec< 4, bool > mask)
 Return a new vector by only loading the value from the pointer p if the mask element is true. More...
 
static svec< 4, float > load_const (const float *p)
 Construct a vector by loading a scalar value from pointer p, and splat it to all the elements in the vector. More...
 
static svec< 4, float > load_and_splat (float *p)
 Construct a vector by loading a scalar value from pointer p, and splat it to all the elements in the vector. More...
 
static svec< 4, float > gather (svec< 4, void * > ptrs, svec< 4, bool > mask)
 Gather the elements pointed by the vector ptrs if the mask element is true, and return a vector. More...
 
static svec< 4, float > gather_base_offsets (float *b, uint32_t scale, svec< 4, int32_t > offsets, svec< 4, bool > mask)
 Gather the elements pointed by calculating the addresses ((char*)b + scale * offsets) if the mask element is true, and return a vector. More...
 
static svec< 4, float > gather_base_offsets (float *b, uint32_t scale, svec< 4, int64_t > offsets, svec< 4, bool > mask)
 Gather the elements pointed by calculating the addresses ((char*)b + scale * offsets) if the mask element is true, and return a vector. More...
 
static svec< 4, float > gather_stride (float *b, int32_t off, int32_t stride)
 Gather the elements pointed by (b+off, b++off+stride, b+off+2*stride, b+off+3*step). More...
 
static svec< 4, float > gather_stride (float *b, int64_t off, int64_t stride)
 Gather the elements pointed by (b+off, b++off+stride, b+off+2*stride, b+off+3*step). More...
 

Public Attributes

float v [4]
 

Friends

std::ostream & operator<< (std::ostream &out, const svec< 4, float > &v)
 

Detailed Description

template<>
struct generic::svec< 4, float >

data representation and operations on a vector of 4 float.

Constructor & Destructor Documentation

generic::svec< 4, float >::svec ( )

Default constructor.

Returns
a vector of 4 undefined float.
generic::svec< 4, float >::svec ( float  a,
float  b,
float  c,
float  d 
)

Constructor.

Returns
a vector of 4 float: {a,b,c,d}.
generic::svec< 4, float >::svec ( float  a)

Constructor.

Parameters
aa float
Returns
a vector of 4 floats: {a,a,a,a}.

Member Function Documentation

svec< 4, float > generic::svec< 4, float >::abs ( )

Return a new vector of the vector's abs value.

svec< 4, float > generic::svec< 4, float >::broadcast ( int32_t  index)

Return a new vector by setting all the elements of the new vector with this vector's index element.

svec< 4, float > generic::svec< 4, float >::ceil ( )

return the ceil VTYPE vector.

svec< 4, float > generic::svec< 4, float >::exp ( )

return the exp VTYPE vector.

svec< 4, float > generic::svec< 4, float >::floor ( )

return the floor VTYPE vector.

svec< 4, float > generic::svec< 4, float >::gather ( svec< 4, void * >  ptrs,
svec< 4, bool >  mask 
)
static

Gather the elements pointed by the vector ptrs if the mask element is true, and return a vector.

svec< 4, float > generic::svec< 4, float >::gather_base_offsets ( float *  b,
uint32_t  scale,
svec< 4, int32_t >  offsets,
svec< 4, bool >  mask 
)
static

Gather the elements pointed by calculating the addresses ((char*)b + scale * offsets) if the mask element is true, and return a vector.

svec< 4, float > generic::svec< 4, float >::gather_base_offsets ( float *  b,
uint32_t  scale,
svec< 4, int64_t >  offsets,
svec< 4, bool >  mask 
)
static

Gather the elements pointed by calculating the addresses ((char*)b + scale * offsets) if the mask element is true, and return a vector.

svec< 4, float > generic::svec< 4, float >::gather_stride ( float *  b,
int32_t  off,
int32_t  stride 
)
static

Gather the elements pointed by (b+off, b++off+stride, b+off+2*stride, b+off+3*step).

svec< 4, float > generic::svec< 4, float >::gather_stride ( float *  b,
int64_t  off,
int64_t  stride 
)
static

Gather the elements pointed by (b+off, b++off+stride, b+off+2*stride, b+off+3*step).

svec< 4, float > generic::svec< 4, float >::load ( svec< 4, float > *  p)
static

load the vector from the pointer p

Parameters
[in]pload address
Note
p does not have to be aligned
Returns
no return value. This vector is updated with value loaded from p.
svec< 4, float > generic::svec< 4, float >::load_and_splat ( float *  p)
static

Construct a vector by loading a scalar value from pointer p, and splat it to all the elements in the vector.

svec< 4, float > generic::svec< 4, float >::load_const ( const float *  p)
static

Construct a vector by loading a scalar value from pointer p, and splat it to all the elements in the vector.

svec< 4, float > generic::svec< 4, float >::log ( )

return the log VTYPE vector.

svec< 4, float > generic::svec< 4, float >::masked_load ( svec< 4, float > *  p,
svec< 4, bool >  mask 
)
static

Return a new vector by only loading the value from the pointer p if the mask element is true.

void generic::svec< 4, float >::masked_store ( svec< 4, float > *  p,
svec< 4, bool >  mask 
)

Store the vector element's value to pointer p if the mask element is true.

svec< 4,bool > generic::svec< 4, float >::operator!= ( svec< 4, float >  a)

Element-wise compare not equal, return a bool vector. E.g. "a != b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare not equal as a boolean vector.
svec< 4, float > generic::svec< 4, float >::operator* ( float  s)

Multiply a vector and a scalar.

svec< 4, float > generic::svec< 4, float >::operator* ( svec< 4, float >  a)

Multiply two vectors.

svec< 4, float > generic::svec< 4, float >::operator+ ( svec< 4, float >  a)

Add two vectors.

svec< 4, float > generic::svec< 4, float >::operator+ ( float  s)

Add a vector and a scalar.

svec< 4, float > generic::svec< 4, float >::operator- ( float  s)

Sub a vector and a scalar.

svec< 4, float > generic::svec< 4, float >::operator- ( )

get the neg value, return a VTYPE vector. E.g. "-a"

svec< 4, float > generic::svec< 4, float >::operator- ( svec< 4, float >  a)

Sub two vectors.

svec< 4, float > generic::svec< 4, float >::operator/ ( svec< 4, float >  a)

Divide a vector by a vector.

svec< 4, float > generic::svec< 4, float >::operator/ ( float  s)

Divide a vector by a scalar.

svec< 4,bool > generic::svec< 4, float >::operator< ( svec< 4, float >  a)

Element-wise compare less than, return a bool vector. E.g. "a < b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare less than as a boolean vector.
svec< 4,bool > generic::svec< 4, float >::operator<= ( svec< 4, float >  a)

Element-wise compare less equal, return a bool vector. E.g. "a <= b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare less equal as a boolean vector.
svec< 4,bool > generic::svec< 4, float >::operator== ( svec< 4, float >  a)

Element-wise compare equal, return a bool vector, e.g., "a == b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare equal as a boolean vector.
svec< 4,bool > generic::svec< 4, float >::operator> ( svec< 4, float >  a)

Element-wise compare greater than, return a bool vector. E.g. "a > b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare greater than as a boolean vector.
svec< 4,bool > generic::svec< 4, float >::operator>= ( svec< 4, float >  a)

Element-wise compare greater equal, return a bool vector. E.g. "a >= b" *.

  • Parameters
    [in]aa vector *
    Returns
    the result of compare greater equal as a boolean vector.
const float generic::svec< 4, float >::operator[] ( int  index) const
float & generic::svec< 4, float >::operator[] ( int  index)

operator [] to set or get the vector element specified by index.

Parameters
indexspecifies the index of the element in the vector.
svec< 4, float > generic::svec< 4, float >::pow ( svec< 4, float >  a)

return the pow VTYPE vector.

svec< 4, float > generic::svec< 4, float >::rcp ( )

return the reverse VTYPE vector. (1.0/thisVec)

float generic::svec< 4, float >::reduce_add ( )

Get the sum of all the element values in the vector. return a float scalar.

float generic::svec< 4, float >::reduce_max ( )

Get the max value of all the element values in the vector. return a float scalar.

float generic::svec< 4, float >::reduce_min ( )

Get the min value of all the element values in the vector. return a float scalar.

svec< 4, float > generic::svec< 4, float >::rotate ( int32_t  index)

Return a new vector by rotate this vector's elements. e.g. newVec[i] = thisVec[i+index].

svec< 4, float > generic::svec< 4, float >::round ( )

return the round VTYPE vector.

svec< 4, float > generic::svec< 4, float >::rsqrt ( )

return the reverse sqrt VTYPE vector. ( 1.0/sqrt(thisVec) )

void generic::svec< 4, float >::scatter ( svec< 4, void * >  ptrs,
svec< 4, bool >  mask 
)

Scatter the vector's elements to the locations pointed by the vector ptrs if the mask element is true.

void generic::svec< 4, float >::scatter_base_offsets ( float *  b,
uint32_t  scale,
svec< 4, int64_t >  offsets,
svec< 4, bool >  mask 
)

Scatter the vector's elements to the addresses ((char*)b + scale * offsets) if the mask element is true.

void generic::svec< 4, float >::scatter_base_offsets ( float *  b,
uint32_t  scale,
svec< 4, int32_t >  offsets,
svec< 4, bool >  mask 
)

Scatter the vector's elements to the addresses ((char*)b + scale * offsets) if the mask element is true.

void generic::svec< 4, float >::scatter_stride ( float *  b,
int64_t  off,
int64_t  stride 
)

Scatter the vector's elements to the addresses (b+off, b++off+stride, b+off+2*stride, b+off+3*step).

void generic::svec< 4, float >::scatter_stride ( float *  b,
int32_t  off,
int32_t  stride 
)

Scatter the vector's elements to the addresses (b+off, b++off+stride, b+off+2*stride, b+off+3*step).

svec< 4, float > generic::svec< 4, float >::shuffle ( svec< 4, int32_t >  index)

Return a new vector by shuffle this vector's elements with index vector e.g. newVec[i] = thisVec[index[i]].

svec< 4, float > generic::svec< 4, float >::sqrt ( )

return the sqrt VTYPE vector.

void generic::svec< 4, float >::store ( svec< 4, float > *  p)

Store the vector to address p.

Parameters
[in]pstore address
Note
p does not have to be aligned

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const svec< 4, float > &  v 
)
friend

Member Data Documentation

float generic::svec< 4, float >::v[4]

The documentation for this struct was generated from the following file: