HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simd::vint8 Class Reference

Integer 8-vector, accelerated by SIMD instructions when available. More...

#include <simd.h>

Public Types

enum  { elements = 8 }
 
enum  { paddedelements =8 }
 
enum  { bits = elements*32 }
 
typedef int value_t
 Underlying equivalent scalar value type. More...
 
typedef simd_raw_t< int,
elements >::type 
simd_t
 the native SIMD type used More...
 
typedef vbool8 vbool_t
 bool type of the same length More...
 
typedef vfloat8 vfloat_t
 float type of the same length More...
 
typedef vint8 vint_t
 int type of the same length More...
 
typedef vbool8 bool_t
 
typedef vfloat8 float_t
 

Public Member Functions

 vint8 ()
 Default constructor (contents undefined) More...
 
 vint8 (int a)
 Construct from a single value (store it in all slots) More...
 
 vint8 (int a, int b)
 Construct from 2 values – (a,a,b,b) More...
 
 vint8 (int a, int b, int c, int d, int e, int f, int g, int h)
 Construct from 8 values (won't work for vint8) More...
 
 vint8 (const int *vals)
 Construct from a pointer to values. More...
 
 vint8 (const unsigned short *vals)
 Construct from a pointer to unsigned short values. More...
 
 vint8 (const short *vals)
 Construct from a pointer to signed short values. More...
 
 vint8 (const unsigned char *vals)
 Construct from a pointer to unsigned char values (0 - 255) More...
 
 vint8 (const char *vals)
 Construct from a pointer to signed char values (-128 - 127) More...
 
 vint8 (const vint8 &other)
 Copy construct from another vint8. More...
 
 vint8 (const vfloat8 &f)
 Convert a vfloat8 to an vint8. Equivalent to i = (int)f;. More...
 
 vint8 (const vint4 &lo, const vint4 &hi)
 Construct from two vint4's. More...
 
 vint8 (const simd_t &m)
 Construct from the underlying SIMD type. More...
 
 operator simd_t () const
 Return the raw SIMD type. More...
 
simd_t simd () const
 
const value_tdata () const
 Return a pointer to the underlying scalar type. More...
 
value_tdata ()
 
void clear ()
 Sset all components to 0. More...
 
const vint8operator= (int a)
 Assign one value to all components. More...
 
const vint8operator= (const vint8 &other)
 Assignment from another vint8. More...
 
int operator[] (int i) const
 Component access (get) More...
 
intoperator[] (int i)
 Component access (set) More...
 
void setcomp (int i, int value)
 Component access (set). More...
 
value_t x () const
 
value_t y () const
 
value_t z () const
 
value_t w () const
 
void set_x (value_t val)
 
void set_y (value_t val)
 
void set_z (value_t val)
 
void set_w (value_t val)
 
vint4 lo () const
 Extract the lower percision vint4. More...
 
vint4 hi () const
 Extract the higher percision vint4. More...
 
void load (int a)
 Helper: load a single int into all components. More...
 
void load (int a, int b, int c, int d, int e, int f, int g, int h)
 Load separate values into each component. More...
 
void load (const int *values)
 Load from an array of 8 values. More...
 
void load (const int *values, int n)
 
void load (const unsigned short *values)
 Load from an array of 8 unsigned short values, convert to vint8. More...
 
void load (const short *values)
 Load from an array of 8 unsigned short values, convert to vint8. More...
 
void load (const unsigned char *values)
 Load from an array of 8 unsigned char values, convert to vint8. More...
 
void load (const char *values)
 Load from an array of 8 unsigned char values, convert to vint8. More...
 
void store (int *values) const
 Store the values into memory. More...
 
void store (int *values, int n) const
 Store the first n values into memory. More...
 
void store (unsigned short *values) const
 
void store (unsigned char *values) const
 
void load_mask (int mask, const value_t *values)
 
void load_mask (const vbool_t &mask, const value_t *values)
 
void store_mask (int mask, value_t *values) const
 
void store_mask (const vbool_t &mask, value_t *values) const
 
template<int scale = 4>
void gather (const value_t *baseptr, const vint_t &vindex)
 Load values from addresses (char*)basepatr + vindex[i]*scale. More...
 
template<int scale = 4>
void gather_mask (const bool_t &mask, const value_t *baseptr, const vint_t &vindex)
 Gather elements defined by the mask, leave others unchanged. More...
 
template<int scale = 4>
void gather_mask (int mask, const value_t *baseptr, const vint_t &vindex)
 
template<int scale = 4>
void scatter (value_t *baseptr, const vint_t &vindex) const
 Store values at addresses (char*)basepatr + vindex[i]*scale. More...
 
template<int scale = 4>
void scatter_mask (const bool_t &mask, value_t *baseptr, const vint_t &vindex) const
 Scatter elements defined by the mask. More...
 
template<int scale = 4>
void scatter_mask (int mask, value_t *baseptr, const vint_t &vindex) const
 
template<int scale>
OIIO_FORCEINLINE void gather (const value_t *baseptr, const vint_t &vindex)
 
template<int scale>
OIIO_FORCEINLINE void gather_mask (const bool_t &mask, const value_t *baseptr, const vint_t &vindex)
 
template<int scale>
OIIO_FORCEINLINE void scatter (value_t *baseptr, const vint_t &vindex) const
 
template<int scale>
OIIO_FORCEINLINE void scatter_mask (const bool_t &mask, value_t *baseptr, const vint_t &vindex) const
 

Static Public Member Functions

static const char * type_name ()
 
static const vint8 Zero ()
 Return an vint8 with all components set to 0. More...
 
static const vint8 One ()
 Return an vint8 with all components set to 1. More...
 
static const vint8 NegOne ()
 Return an vint8 with all components set to -1 (aka 0xffffffff) More...
 
static const vint8 Iota (int start=0, int step=1)
 
static const vint8 Giota ()
 Return an vint8 with "geometric" iota: (1, 2, 4, 8, ...). More...
 

Friends

vint8 operator+ (const vint8 &a, const vint8 &b)
 
vint8 operator- (const vint8 &a)
 
vint8 operator- (const vint8 &a, const vint8 &b)
 
vint8 operator* (const vint8 &a, const vint8 &b)
 
vint8 operator/ (const vint8 &a, const vint8 &b)
 
vint8 operator% (const vint8 &a, const vint8 &b)
 
const vint8operator+= (vint8 &a, const vint8 &b)
 
const vint8operator-= (vint8 &a, const vint8 &b)
 
const vint8operator*= (vint8 &a, const vint8 &b)
 
const vint8operator/= (vint8 &a, const vint8 &b)
 
const vint8operator%= (vint8 &a, const vint8 &b)
 
vint8 operator& (const vint8 &a, const vint8 &b)
 
vint8 operator| (const vint8 &a, const vint8 &b)
 
vint8 operator^ (const vint8 &a, const vint8 &b)
 
const vint8operator&= (vint8 &a, const vint8 &b)
 
const vint8operator|= (vint8 &a, const vint8 &b)
 
const vint8operator^= (vint8 &a, const vint8 &b)
 
vint8 operator~ (const vint8 &a)
 
vint8 operator<< (const vint8 &a, unsigned int bits)
 
vint8 operator>> (const vint8 &a, unsigned int bits)
 
const vint8operator<<= (vint8 &a, unsigned int bits)
 
const vint8operator>>= (vint8 &a, unsigned int bits)
 
vbool8 operator== (const vint8 &a, const vint8 &b)
 
vbool8 operator!= (const vint8 &a, const vint8 &b)
 
vbool8 operator< (const vint8 &a, const vint8 &b)
 
vbool8 operator> (const vint8 &a, const vint8 &b)
 
vbool8 operator>= (const vint8 &a, const vint8 &b)
 
vbool8 operator<= (const vint8 &a, const vint8 &b)
 
std::ostream & operator<< (std::ostream &cout, const vint8 &a)
 Stream output. More...
 

Detailed Description

Integer 8-vector, accelerated by SIMD instructions when available.

Definition at line 1176 of file simd.h.

Member Typedef Documentation

Definition at line 1187 of file simd.h.

Definition at line 1188 of file simd.h.

the native SIMD type used

Definition at line 1183 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 1179 of file simd.h.

bool type of the same length

Definition at line 1184 of file simd.h.

float type of the same length

Definition at line 1185 of file simd.h.

int type of the same length

Definition at line 1186 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 1180 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 1181 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 1182 of file simd.h.

Constructor & Destructor Documentation

simd::vint8::vint8 ( )
inline

Default constructor (contents undefined)

Definition at line 1191 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( int  a)

Construct from a single value (store it in all slots)

Definition at line 4869 of file simd.h.

simd::vint8::vint8 ( int  a,
int  b 
)

Construct from 2 values – (a,a,b,b)

OIIO_FORCEINLINE simd::vint8::vint8 ( int  a,
int  b,
int  c,
int  d,
int  e,
int  f,
int  g,
int  h 
)

Construct from 8 values (won't work for vint8)

Definition at line 4871 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const int vals)

Construct from a pointer to values.

Definition at line 4876 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const unsigned short *  vals)
explicit

Construct from a pointer to unsigned short values.

Definition at line 4877 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const short *  vals)
explicit

Construct from a pointer to signed short values.

Definition at line 4878 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const unsigned char *  vals)
explicit

Construct from a pointer to unsigned char values (0 - 255)

Definition at line 4879 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const char *  vals)
explicit

Construct from a pointer to signed char values (-128 - 127)

Definition at line 4880 of file simd.h.

simd::vint8::vint8 ( const vint8 other)
inline

Copy construct from another vint8.

Definition at line 1218 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const vfloat8 f)
explicit

Convert a vfloat8 to an vint8. Equivalent to i = (int)f;.

Definition at line 8527 of file simd.h.

OIIO_FORCEINLINE simd::vint8::vint8 ( const vint4 lo,
const vint4 hi 
)

Construct from two vint4's.

Definition at line 5037 of file simd.h.

simd::vint8::vint8 ( const simd_t m)
inline

Construct from the underlying SIMD type.

Definition at line 1227 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vint8::clear ( )

Sset all components to 0.

Definition at line 4987 of file simd.h.

const value_t* simd::vint8::data ( ) const
inline

Return a pointer to the underlying scalar type.

Definition at line 1234 of file simd.h.

value_t* simd::vint8::data ( )
inline

Definition at line 1235 of file simd.h.

template<int scale = 4>
void simd::vint8::gather ( const value_t baseptr,
const vint_t vindex 
)

Load values from addresses (char*)basepatr + vindex[i]*scale.

template<int scale>
OIIO_FORCEINLINE void simd::vint8::gather ( const value_t baseptr,
const vint_t vindex 
)

Definition at line 4943 of file simd.h.

template<int scale = 4>
void simd::vint8::gather_mask ( const bool_t mask,
const value_t baseptr,
const vint_t vindex 
)

Gather elements defined by the mask, leave others unchanged.

template<int scale = 4>
void simd::vint8::gather_mask ( int  mask,
const value_t baseptr,
const vint_t vindex 
)
template<int scale>
OIIO_FORCEINLINE void simd::vint8::gather_mask ( const bool_t mask,
const value_t baseptr,
const vint_t vindex 
)

Definition at line 4954 of file simd.h.

OIIO_FORCEINLINE const vint8 simd::vint8::Giota ( )
static

Return an vint8 with "geometric" iota: (1, 2, 4, 8, ...).

Definition at line 5015 of file simd.h.

OIIO_FORCEINLINE vint4 simd::vint8::hi ( ) const

Extract the higher percision vint4.

Definition at line 5028 of file simd.h.

OIIO_FORCEINLINE const vint8 simd::vint8::Iota ( int  start = 0,
int  step = 1 
)
static

Return an vint8 with incremented components (e.g., 0,1,2,3). Optional arguments can give a non-zero starting point and step size.

Definition at line 5009 of file simd.h.

OIIO_FORCEINLINE vint4 simd::vint8::lo ( ) const

Extract the lower percision vint4.

Definition at line 5020 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( int  a)

Helper: load a single int into all components.

Definition at line 4769 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( int  a,
int  b,
int  c,
int  d,
int  e,
int  f,
int  g,
int  h 
)

Load separate values into each component.

Definition at line 4778 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const int values)

Load from an array of 8 values.

Definition at line 4795 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const int values,
int  n 
)

Definition at line 4804 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const unsigned short *  values)

Load from an array of 8 unsigned short values, convert to vint8.

Definition at line 4840 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const short *  values)

Load from an array of 8 unsigned short values, convert to vint8.

Definition at line 4832 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const unsigned char *  values)

Load from an array of 8 unsigned char values, convert to vint8.

Definition at line 4858 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load ( const char *  values)

Load from an array of 8 unsigned char values, convert to vint8.

Definition at line 4849 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load_mask ( int  mask,
const value_t values 
)

Masked load – read from values[] where mask is 1, load zero where mask is 0.

Definition at line 4897 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::load_mask ( const vbool_t mask,
const value_t values 
)

Definition at line 4908 of file simd.h.

OIIO_FORCEINLINE const vint8 simd::vint8::NegOne ( )
static

Return an vint8 with all components set to -1 (aka 0xffffffff)

Definition at line 5006 of file simd.h.

OIIO_FORCEINLINE const vint8 simd::vint8::One ( )
static

Return an vint8 with all components set to 1.

Definition at line 5004 of file simd.h.

simd::vint8::operator simd_t ( ) const
inline

Return the raw SIMD type.

Definition at line 1230 of file simd.h.

OIIO_FORCEINLINE const vint8 & simd::vint8::operator= ( int  a)

Assign one value to all components.

Definition at line 4882 of file simd.h.

OIIO_FORCEINLINE const vint8 & simd::vint8::operator= ( const vint8 other)

Assignment from another vint8.

Definition at line 4748 of file simd.h.

OIIO_FORCEINLINE int simd::vint8::operator[] ( int  i) const

Component access (get)

Definition at line 4753 of file simd.h.

OIIO_FORCEINLINE int & simd::vint8::operator[] ( int  i)

Component access (set)

Definition at line 4758 of file simd.h.

template<int scale = 4>
void simd::vint8::scatter ( value_t baseptr,
const vint_t vindex 
) const

Store values at addresses (char*)basepatr + vindex[i]*scale.

template<int scale>
OIIO_FORCEINLINE void simd::vint8::scatter ( value_t baseptr,
const vint_t vindex 
) const

Definition at line 4965 of file simd.h.

template<int scale = 4>
void simd::vint8::scatter_mask ( const bool_t mask,
value_t baseptr,
const vint_t vindex 
) const

Scatter elements defined by the mask.

template<int scale = 4>
void simd::vint8::scatter_mask ( int  mask,
value_t baseptr,
const vint_t vindex 
) const
template<int scale>
OIIO_FORCEINLINE void simd::vint8::scatter_mask ( const bool_t mask,
value_t baseptr,
const vint_t vindex 
) const

Definition at line 4976 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::set_w ( value_t  val)

Definition at line 5358 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::set_x ( value_t  val)

Definition at line 5355 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::set_y ( value_t  val)

Definition at line 5356 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::set_z ( value_t  val)

Definition at line 5357 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::setcomp ( int  i,
int  value 
)

Component access (set).

Definition at line 4763 of file simd.h.

simd_t simd::vint8::simd ( ) const
inline

Definition at line 1231 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store ( int values) const

Store the values into memory.

Definition at line 4885 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store ( int values,
int  n 
) const

Store the first n values into memory.

Definition at line 5265 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store ( unsigned short *  values) const

Store the least significant 16 bits of each element into adjacent unsigned shorts.

Definition at line 5290 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store ( unsigned char *  values) const

Store the least significant 8 bits of each element into adjacent unsigned chars.

Definition at line 5302 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store_mask ( int  mask,
value_t values 
) const

Masked store – write to values[] where mask is enabled, don't touch values[] where it's not.

Definition at line 4919 of file simd.h.

OIIO_FORCEINLINE void simd::vint8::store_mask ( const vbool_t mask,
value_t values 
) const

Definition at line 4930 of file simd.h.

static const char* simd::vint8::type_name ( )
inlinestatic

Definition at line 1178 of file simd.h.

OIIO_FORCEINLINE int simd::vint8::w ( ) const

Definition at line 5354 of file simd.h.

OIIO_FORCEINLINE int simd::vint8::x ( ) const

Definition at line 5351 of file simd.h.

OIIO_FORCEINLINE int simd::vint8::y ( ) const

Definition at line 5352 of file simd.h.

OIIO_FORCEINLINE int simd::vint8::z ( ) const

Definition at line 5353 of file simd.h.

OIIO_FORCEINLINE const vint8 simd::vint8::Zero ( )
static

Return an vint8 with all components set to 0.

Definition at line 4996 of file simd.h.

Friends And Related Function Documentation

vbool8 operator!= ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5214 of file simd.h.

vint8 operator% ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5108 of file simd.h.

const vint8& operator%= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5113 of file simd.h.

vint8 operator& ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5123 of file simd.h.

const vint8& operator&= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5131 of file simd.h.

vint8 operator* ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5087 of file simd.h.

const vint8& operator*= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5096 of file simd.h.

vint8 operator+ ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5050 of file simd.h.

const vint8& operator+= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5059 of file simd.h.

vint8 operator- ( const vint8 a)
friend

Definition at line 5064 of file simd.h.

vint8 operator- ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5073 of file simd.h.

const vint8& operator-= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5082 of file simd.h.

vint8 operator/ ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5100 of file simd.h.

const vint8& operator/= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5105 of file simd.h.

vbool8 operator< ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5232 of file simd.h.

vint8 operator<< ( const vint8 a,
unsigned int  bits 
)
friend

Definition at line 5163 of file simd.h.

std::ostream& operator<< ( std::ostream &  cout,
const vint8 a 
)
friend

Stream output.

Definition at line 5257 of file simd.h.

const vint8& operator<<= ( vint8 a,
unsigned int  bits 
)
friend

Definition at line 5174 of file simd.h.

vbool8 operator<= ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5251 of file simd.h.

vbool8 operator== ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5202 of file simd.h.

vbool8 operator> ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5220 of file simd.h.

vbool8 operator>= ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5245 of file simd.h.

vint8 operator>> ( const vint8 a,
unsigned int  bits 
)
friend

Definition at line 5178 of file simd.h.

const vint8& operator>>= ( vint8 a,
unsigned int  bits 
)
friend

Definition at line 5188 of file simd.h.

vint8 operator^ ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5143 of file simd.h.

const vint8& operator^= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5151 of file simd.h.

vint8 operator| ( const vint8 a,
const vint8 b 
)
friend

Definition at line 5133 of file simd.h.

const vint8& operator|= ( vint8 a,
const vint8 b 
)
friend

Definition at line 5141 of file simd.h.

vint8 operator~ ( const vint8 a)
friend

Definition at line 5154 of file simd.h.

Member Data Documentation

simd_raw_t<int,4>::type simd::vint8::m_4[2]

Definition at line 1391 of file simd.h.

simd_t simd::vint8::m_simd

Definition at line 1389 of file simd.h.

value_t simd::vint8::m_val[elements]

Definition at line 1390 of file simd.h.


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