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
 
simd_tsimd ()
 
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 precision vint4. More...
 
vint4 hi () const
 Extract the higher precision 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 vbool_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 vbool_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 vbool_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 vbool_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 1180 of file simd.h.

Member Typedef Documentation

Definition at line 1192 of file simd.h.

Definition at line 1194 of file simd.h.

the native SIMD type used

Definition at line 1187 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 1183 of file simd.h.

bool type of the same length

Definition at line 1188 of file simd.h.

float type of the same length

Definition at line 1189 of file simd.h.

int type of the same length

Definition at line 1190 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 1184 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 1185 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 1186 of file simd.h.

Constructor & Destructor Documentation

simd::vint8::vint8 ( )
inline

Default constructor (contents undefined)

Definition at line 1197 of file simd.h.

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

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

Definition at line 5047 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 5049 of file simd.h.

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

Construct from a pointer to values.

Definition at line 5054 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 5055 of file simd.h.

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

Construct from a pointer to signed short values.

Definition at line 5056 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 5057 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 5058 of file simd.h.

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

Copy construct from another vint8.

Definition at line 1224 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 8890 of file simd.h.

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

Construct from two vint4's.

Definition at line 5218 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 1233 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vint8::clear ( )

Sset all components to 0.

Definition at line 5168 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 1241 of file simd.h.

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

Definition at line 1242 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 5124 of file simd.h.

template<int scale = 4>
void simd::vint8::gather_mask ( const vbool_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 vbool_t mask,
const value_t baseptr,
const vint_t vindex 
)

Definition at line 5135 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 5196 of file simd.h.

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

Extract the higher precision vint4.

Definition at line 5209 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 5190 of file simd.h.

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

Extract the lower precision vint4.

Definition at line 5201 of file simd.h.

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

Helper: load a single int into all components.

Definition at line 4926 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 4938 of file simd.h.

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

Load from an array of 8 values.

Definition at line 4958 of file simd.h.

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

Definition at line 4970 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 5009 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 4998 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 5033 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 5021 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 5078 of file simd.h.

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

Definition at line 5089 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 5187 of file simd.h.

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

Return an vint8 with all components set to 1.

Definition at line 5185 of file simd.h.

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

Return the raw SIMD type.

Definition at line 1236 of file simd.h.

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

Assign one value to all components.

Definition at line 5060 of file simd.h.

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

Assignment from another vint8.

Definition at line 4905 of file simd.h.

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

Component access (get)

Definition at line 4910 of file simd.h.

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

Component access (set)

Definition at line 4915 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 5146 of file simd.h.

template<int scale = 4>
void simd::vint8::scatter_mask ( const vbool_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 vbool_t mask,
value_t baseptr,
const vint_t vindex 
) const

Definition at line 5157 of file simd.h.

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

Definition at line 5539 of file simd.h.

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

Definition at line 5536 of file simd.h.

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

Definition at line 5537 of file simd.h.

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

Definition at line 5538 of file simd.h.

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

Component access (set).

Definition at line 4920 of file simd.h.

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

Definition at line 1237 of file simd.h.

simd_t& simd::vint8::simd ( )
inline

Definition at line 1238 of file simd.h.

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

Store the values into memory.

Definition at line 5063 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 5446 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 5471 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 5483 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 5100 of file simd.h.

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

Definition at line 5111 of file simd.h.

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

Definition at line 1182 of file simd.h.

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

Definition at line 5535 of file simd.h.

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

Definition at line 5532 of file simd.h.

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

Definition at line 5533 of file simd.h.

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

Definition at line 5534 of file simd.h.

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

Return an vint8 with all components set to 0.

Definition at line 5177 of file simd.h.

Friends And Related Function Documentation

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

Definition at line 5395 of file simd.h.

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

Definition at line 5289 of file simd.h.

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

Definition at line 5294 of file simd.h.

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

Definition at line 5304 of file simd.h.

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

Definition at line 5312 of file simd.h.

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

Definition at line 5268 of file simd.h.

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

Definition at line 5277 of file simd.h.

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

Definition at line 5231 of file simd.h.

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

Definition at line 5240 of file simd.h.

vint8 operator- ( const vint8 a)
friend

Definition at line 5245 of file simd.h.

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

Definition at line 5254 of file simd.h.

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

Definition at line 5263 of file simd.h.

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

Definition at line 5281 of file simd.h.

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

Definition at line 5286 of file simd.h.

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

Definition at line 5413 of file simd.h.

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

Definition at line 5344 of file simd.h.

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

Stream output.

Definition at line 5438 of file simd.h.

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

Definition at line 5355 of file simd.h.

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

Definition at line 5432 of file simd.h.

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

Definition at line 5383 of file simd.h.

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

Definition at line 5401 of file simd.h.

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

Definition at line 5426 of file simd.h.

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

Definition at line 5359 of file simd.h.

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

Definition at line 5369 of file simd.h.

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

Definition at line 5324 of file simd.h.

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

Definition at line 5332 of file simd.h.

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

Definition at line 5314 of file simd.h.

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

Definition at line 5322 of file simd.h.

vint8 operator~ ( const vint8 a)
friend

Definition at line 5335 of file simd.h.

Member Data Documentation

vint4 simd::vint8::m_4[2]

Definition at line 1398 of file simd.h.

simd_t simd::vint8::m_simd

Definition at line 1396 of file simd.h.

value_t simd::vint8::m_val[elements]

Definition at line 1397 of file simd.h.


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