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< 8, float > Struct Template Reference

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

#include <generic8.h>

Public Member Functions

 svec ()
 Default constructor. More...
 
 svec (float a, float b, float c, float d, float e, float f, float g, float h)
 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< 8,bool > operator== (svec< 8, float > a)
 Element-wise compare equal, return a bool vector, e.g., "a == b" *. More...
 
svec< 8,bool > operator!= (svec< 8, float > a)
 Element-wise compare not equal, return a bool vector. E.g. "a != b" *. More...
 
svec< 8,bool > operator< (svec< 8, float > a)
 Element-wise compare less than, return a bool vector. E.g. "a < b" *. More...
 
svec< 8,bool > operator<= (svec< 8, float > a)
 Element-wise compare less equal, return a bool vector. E.g. "a <= b" *. More...
 
svec< 8,bool > operator> (svec< 8, float > a)
 Element-wise compare greater than, return a bool vector. E.g. "a > b" *. More...
 
svec< 8,bool > operator>= (svec< 8, float > a)
 Element-wise compare greater equal, return a bool vector. E.g. "a >= b" *. More...
 
svec< 8, 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< 8, float > operator+ (svec< 8, float > a)
 Add two vectors. More...
 
svec< 8, float > operator+ (float s)
 Add a vector and a scalar. More...
 
svec< 8, float > operator- (svec< 8, float > a)
 Sub two vectors. More...
 
svec< 8, float > operator- (float s)
 Sub a vector and a scalar. More...
 
svec< 8, float > operator* (svec< 8, float > a)
 Multiply two vectors. More...
 
svec< 8, float > operator* (float s)
 Multiply a vector and a scalar. More...
 
svec< 8, float > operator/ (svec< 8, float > a)
 Divide a vector by a vector. More...
 
svec< 8, float > operator/ (float s)
 Divide a vector by a scalar. More...
 
void store (svec< 8, float > *p)
 Store the vector to address p. More...
 
void masked_store (svec< 8, float > *p, svec< 8, bool > mask)
 Store the vector element's value to pointer p if the mask element is true. More...
 
void scatter (svec< 8, void * > ptrs, svec< 8, 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< 8, int32_t > offsets, svec< 8, 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< 8, int64_t > offsets, svec< 8, 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< 8, 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< 8, float > rotate (int32_t index)
 Return a new vector by rotate this vector's elements. e.g. newVec[i] = thisVec[i+index]. More...
 
svec< 8, float > shuffle (svec< 8, 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< 8, float > abs ()
 Return a new vector of the vector's abs value. More...
 
svec< 8, float > round ()
 return the round VTYPE vector. More...
 
svec< 8, float > floor ()
 return the floor VTYPE vector. More...
 
svec< 8, float > ceil ()
 return the ceil VTYPE vector. More...
 
svec< 8, float > sqrt ()
 return the sqrt VTYPE vector. More...
 
svec< 8, float > rcp ()
 return the reverse VTYPE vector. (1.0/thisVec) More...
 
svec< 8, float > rsqrt ()
 return the reverse sqrt VTYPE vector. ( 1.0/sqrt(thisVec) ) More...
 
svec< 8, float > exp ()
 return the exp VTYPE vector. More...
 
svec< 8, float > log ()
 return the log VTYPE vector. More...
 
svec< 8, float > pow (svec< 8, float > a)
 return the pow VTYPE vector. More...
 

Static Public Member Functions

static svec< 8, float > load (svec< 8, float > *p)
 load the vector from the pointer p More...
 
static svec< 8, float > masked_load (svec< 8, float > *p, svec< 8, bool > mask)
 Return a new vector by only loading the value from the pointer p if the mask element is true. More...
 
static svec< 8, 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< 8, 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< 8, float > gather (svec< 8, void * > ptrs, svec< 8, bool > mask)
 Gather the elements pointed by the vector ptrs if the mask element is true, and return a vector. More...
 
static svec< 8, float > gather_base_offsets (float *b, uint32_t scale, svec< 8, int32_t > offsets, svec< 8, 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< 8, float > gather_base_offsets (float *b, uint32_t scale, svec< 8, int64_t > offsets, svec< 8, 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< 8, 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< 8, 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 [8]
 

Friends

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

Detailed Description

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

data representation and operations on a vector of 8 float.

Constructor & Destructor Documentation

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

Default constructor.

Returns
a vector of 8 undefined float.
generic::svec< 8, float >::svec ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
float  g,
float  h 
)

Constructor.

Returns
a vector of 8 float: {a,b,c,d,e,f,g,h}.
generic::svec< 8, float >::svec ( float  a)

Constructor.

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

Member Function Documentation

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

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

svec< 8, float > generic::svec< 8, 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< 8, float > generic::svec< 8, float >::ceil ( )

return the ceil VTYPE vector.

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

return the exp VTYPE vector.

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

return the floor VTYPE vector.

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

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

svec< 8, float > generic::svec< 8, float >::gather_base_offsets ( float *  b,
uint32_t  scale,
svec< 8, int32_t >  offsets,
svec< 8, 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< 8, float > generic::svec< 8, float >::gather_base_offsets ( float *  b,
uint32_t  scale,
svec< 8, int64_t >  offsets,
svec< 8, 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< 8, float > generic::svec< 8, 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< 8, float > generic::svec< 8, 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< 8, float > generic::svec< 8, float >::load ( svec< 8, 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< 8, float > generic::svec< 8, 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< 8, float > generic::svec< 8, 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< 8, float > generic::svec< 8, float >::log ( )

return the log VTYPE vector.

svec< 8, float > generic::svec< 8, float >::masked_load ( svec< 8, float > *  p,
svec< 8, 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< 8, float >::masked_store ( svec< 8, float > *  p,
svec< 8, bool >  mask 
)

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

svec< 8,bool > generic::svec< 8, float >::operator!= ( svec< 8, 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< 8, float > generic::svec< 8, float >::operator* ( float  s)

Multiply a vector and a scalar.

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

Multiply two vectors.

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

Add two vectors.

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

Add a vector and a scalar.

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

Sub a vector and a scalar.

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

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

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

Sub two vectors.

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

Divide a vector by a vector.

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

Divide a vector by a scalar.

svec< 8,bool > generic::svec< 8, float >::operator< ( svec< 8, 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< 8,bool > generic::svec< 8, float >::operator<= ( svec< 8, 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< 8,bool > generic::svec< 8, float >::operator== ( svec< 8, 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< 8,bool > generic::svec< 8, float >::operator> ( svec< 8, 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< 8,bool > generic::svec< 8, float >::operator>= ( svec< 8, 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< 8, float >::operator[] ( int  index) const
float & generic::svec< 8, 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< 8, float > generic::svec< 8, float >::pow ( svec< 8, float >  a)

return the pow VTYPE vector.

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

return the reverse VTYPE vector. (1.0/thisVec)

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

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

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

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

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

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

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

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

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

return the round VTYPE vector.

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

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

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

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

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

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

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

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

void generic::svec< 8, 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< 8, 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< 8, float > generic::svec< 8, float >::shuffle ( svec< 8, int32_t >  index)

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

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

return the sqrt VTYPE vector.

void generic::svec< 8, float >::store ( svec< 8, 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< 8, float > &  v 
)
friend

Member Data Documentation

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

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