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
vsx::svec< 4, double > Struct Template Reference

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

#include <power_vsx4.h>

Public Member Functions

 svec ()
 Default constructor. More...
 
 svec (__vector double a, __vector double b)
 For internal use only. Construct svec<4,double> with two __vector double values. More...
 
 svec (double a, double b, double c, double d)
 Constructor. More...
 
 svec (double a)
 Constructor. More...
 
double & operator[] (int index)
 operator [] to set or get the vector element specified by index. More...
 
const double operator[] (int index) const
 
svec< 4,bool > operator== (svec< 4, double > a)
 Element-wise compare equal, return a bool vector, e.g., "a == b" *. More...
 
svec< 4,bool > operator!= (svec< 4, double > a)
 Element-wise compare not equal, return a bool vector. E.g. "a != b" *. More...
 
svec< 4,bool > operator< (svec< 4, double > a)
 Element-wise compare less than, return a bool vector. E.g. "a < b" *. More...
 
svec< 4,bool > operator<= (svec< 4, double > a)
 Element-wise compare less equal, return a bool vector. E.g. "a <= b" *. More...
 
svec< 4,bool > operator> (svec< 4, double > a)
 Element-wise compare greater than, return a bool vector. E.g. "a > b" *. More...
 
svec< 4,bool > operator>= (svec< 4, double > a)
 Element-wise compare greater equal, return a bool vector. E.g. "a >= b" *. More...
 
svec< 4, double > operator- ()
 get the neg value, return a VTYPE vector. E.g. "-a" More...
 
double reduce_add ()
 Get the sum of all the element values in the vector. return a double scalar. More...
 
double reduce_max ()
 Get the max value of all the element values in the vector. return a double scalar. More...
 
double reduce_min ()
 Get the min value of all the element values in the vector. return a double scalar. More...
 
svec< 4, double > operator+ (svec< 4, double > a)
 Add two vectors. More...
 
svec< 4, double > operator+ (double s)
 Add a vector and a scalar. More...
 
svec< 4, double > operator- (svec< 4, double > a)
 Sub two vectors. More...
 
svec< 4, double > operator- (double s)
 Sub a vector and a scalar. More...
 
svec< 4, double > operator* (svec< 4, double > a)
 Multiply two vectors. More...
 
svec< 4, double > operator* (double s)
 Multiply a vector and a scalar. More...
 
svec< 4, double > operator/ (svec< 4, double > a)
 Divide a vector by a vector. More...
 
svec< 4, double > operator/ (double s)
 Divide a vector by a scalar. More...
 
void store (svec< 4, double > *p)
 Store the vector to address p. More...
 
void masked_store (svec< 4, double > *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 (double *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 (double *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 (double *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 (double *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, double > 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, double > rotate (int32_t index)
 Return a new vector by rotate this vector's elements. e.g. newVec[i] = thisVec[i+index]. More...
 
svec< 4, double > 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, double > abs ()
 Return a new vector of the vector's abs value. More...
 
svec< 4, double > round ()
 return the round VTYPE vector. More...
 
svec< 4, double > floor ()
 return the floor VTYPE vector. More...
 
svec< 4, double > ceil ()
 return the ceil VTYPE vector. More...
 
svec< 4, double > sqrt ()
 return the sqrt VTYPE vector. More...
 
svec< 4, double > rcp ()
 return the reverse VTYPE vector. (1.0/thisVec) More...
 
svec< 4, double > rsqrt ()
 return the reverse sqrt VTYPE vector. ( 1.0/sqrt(thisVec) ) More...
 
svec< 4, double > exp ()
 return the exp VTYPE vector. More...
 
svec< 4, double > log ()
 return the log VTYPE vector. More...
 
svec< 4, double > pow (svec< 4, double > a)
 return the pow VTYPE vector. More...
 

Static Public Member Functions

static svec< 4, double > load (svec< 4, double > *p)
 load the vector from the pointer p More...
 
static svec< 4, double > masked_load (svec< 4, double > *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, double > load_const (const double *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, double > load_and_splat (double *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, double > 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, double > gather_base_offsets (double *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, double > gather_base_offsets (double *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, double > gather_stride (double *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, double > gather_stride (double *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

__vector double v [2]
 

Friends

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

Detailed Description

template<>
struct vsx::svec< 4, double >

data representation and operations on a vector of 4 double.

Constructor & Destructor Documentation

vsx::svec< 4, double >::svec ( )

Default constructor.

Returns
a vector of 4 undefined double.
vsx::svec< 4, double >::svec ( __vector double  a,
__vector double  b 
)

For internal use only. Construct svec<4,double> with two __vector double values.

Returns
a double vector, whose value is from a and b.
vsx::svec< 4, double >::svec ( double  a,
double  b,
double  c,
double  d 
)

Constructor.

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

Constructor.

Parameters
aa double
Returns
a vector of 4 doubles: {a,a,a,a}.

Member Function Documentation

svec< 4, double > vsx::svec< 4, double >::abs ( )

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

svec< 4, double > vsx::svec< 4, double >::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, double > vsx::svec< 4, double >::ceil ( )

return the ceil VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::exp ( )

return the exp VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::floor ( )

return the floor VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::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, double > vsx::svec< 4, double >::gather_base_offsets ( double *  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, double > vsx::svec< 4, double >::gather_base_offsets ( double *  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, double > vsx::svec< 4, double >::gather_stride ( double *  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, double > vsx::svec< 4, double >::gather_stride ( double *  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, double > vsx::svec< 4, double >::load ( svec< 4, double > *  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, double > vsx::svec< 4, double >::load_and_splat ( double *  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, double > vsx::svec< 4, double >::load_const ( const double *  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, double > vsx::svec< 4, double >::log ( )

return the log VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::masked_load ( svec< 4, double > *  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 vsx::svec< 4, double >::masked_store ( svec< 4, double > *  p,
svec< 4, bool >  mask 
)

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

svec< 4,bool > vsx::svec< 4, double >::operator!= ( svec< 4, double >  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, double > vsx::svec< 4, double >::operator* ( double  s)

Multiply a vector and a scalar.

svec< 4, double > vsx::svec< 4, double >::operator* ( svec< 4, double >  a)

Multiply two vectors.

svec< 4, double > vsx::svec< 4, double >::operator+ ( svec< 4, double >  a)

Add two vectors.

svec< 4, double > vsx::svec< 4, double >::operator+ ( double  s)

Add a vector and a scalar.

svec< 4, double > vsx::svec< 4, double >::operator- ( double  s)

Sub a vector and a scalar.

svec< 4, double > vsx::svec< 4, double >::operator- ( )

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

svec< 4, double > vsx::svec< 4, double >::operator- ( svec< 4, double >  a)

Sub two vectors.

svec< 4, double > vsx::svec< 4, double >::operator/ ( svec< 4, double >  a)

Divide a vector by a vector.

svec< 4, double > vsx::svec< 4, double >::operator/ ( double  s)

Divide a vector by a scalar.

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

return the pow VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::rcp ( )

return the reverse VTYPE vector. (1.0/thisVec)

double vsx::svec< 4, double >::reduce_add ( )

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

double vsx::svec< 4, double >::reduce_max ( )

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

double vsx::svec< 4, double >::reduce_min ( )

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

svec< 4, double > vsx::svec< 4, double >::rotate ( int32_t  index)

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

svec< 4, double > vsx::svec< 4, double >::round ( )

return the round VTYPE vector.

svec< 4, double > vsx::svec< 4, double >::rsqrt ( )

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

void vsx::svec< 4, double >::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 vsx::svec< 4, double >::scatter_base_offsets ( double *  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 vsx::svec< 4, double >::scatter_base_offsets ( double *  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 vsx::svec< 4, double >::scatter_stride ( double *  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 vsx::svec< 4, double >::scatter_stride ( double *  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, double > vsx::svec< 4, double >::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, double > vsx::svec< 4, double >::sqrt ( )

return the sqrt VTYPE vector.

void vsx::svec< 4, double >::store ( svec< 4, double > *  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, double > &  v 
)
friend

Member Data Documentation

__vector double vsx::svec< 4, double >::v[2]

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