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 constexpr size_t size () noexcept
 
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 1249 of file simd.h.

Member Typedef Documentation

Definition at line 1261 of file simd.h.

Definition at line 1263 of file simd.h.

the native SIMD type used

Definition at line 1256 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 1252 of file simd.h.

bool type of the same length

Definition at line 1257 of file simd.h.

float type of the same length

Definition at line 1258 of file simd.h.

int type of the same length

Definition at line 1259 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 1253 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 1254 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 1255 of file simd.h.

Constructor & Destructor Documentation

simd::vint8::vint8 ( )
inline

Default constructor (contents undefined)

Definition at line 1267 of file simd.h.

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

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

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

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

Construct from a pointer to values.

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

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

Construct from a pointer to signed short values.

Definition at line 5223 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 5224 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 5225 of file simd.h.

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

Copy construct from another vint8.

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

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

Construct from two vint4's.

Definition at line 5385 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 1303 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vint8::clear ( )

Sset all components to 0.

Definition at line 5335 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 1311 of file simd.h.

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

Definition at line 1312 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 5291 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 5302 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 5363 of file simd.h.

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

Extract the higher precision vint4.

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

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

Extract the lower precision vint4.

Definition at line 5368 of file simd.h.

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

Helper: load a single int into all components.

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

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

Load from an array of 8 values.

Definition at line 5125 of file simd.h.

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

Definition at line 5137 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 5176 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 5165 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 5200 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 5188 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 5245 of file simd.h.

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

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

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

Return an vint8 with all components set to 1.

Definition at line 5352 of file simd.h.

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

Return the raw SIMD type.

Definition at line 1306 of file simd.h.

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

Assign one value to all components.

Definition at line 5227 of file simd.h.

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

Assignment from another vint8.

Definition at line 5072 of file simd.h.

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

Component access (get)

Definition at line 5077 of file simd.h.

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

Component access (set)

Definition at line 5082 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 5313 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 5324 of file simd.h.

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

Definition at line 5706 of file simd.h.

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

Definition at line 5703 of file simd.h.

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

Definition at line 5704 of file simd.h.

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

Definition at line 5705 of file simd.h.

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

Component access (set).

Definition at line 5087 of file simd.h.

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

Definition at line 1307 of file simd.h.

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

Definition at line 1308 of file simd.h.

static constexpr size_t simd::vint8::size ( void  )
inlinestaticnoexcept

Definition at line 1264 of file simd.h.

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

Store the values into memory.

Definition at line 5230 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 5613 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 5638 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 5650 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 5267 of file simd.h.

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

Definition at line 5278 of file simd.h.

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

Definition at line 1251 of file simd.h.

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

Definition at line 5702 of file simd.h.

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

Definition at line 5699 of file simd.h.

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

Definition at line 5700 of file simd.h.

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

Definition at line 5701 of file simd.h.

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

Return an vint8 with all components set to 0.

Definition at line 5344 of file simd.h.

Friends And Related Function Documentation

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

Definition at line 5562 of file simd.h.

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

Definition at line 5456 of file simd.h.

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

Definition at line 5461 of file simd.h.

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

Definition at line 5471 of file simd.h.

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

Definition at line 5479 of file simd.h.

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

Definition at line 5435 of file simd.h.

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

Definition at line 5444 of file simd.h.

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

Definition at line 5398 of file simd.h.

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

Definition at line 5407 of file simd.h.

vint8 operator- ( const vint8 a)
friend

Definition at line 5412 of file simd.h.

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

Definition at line 5421 of file simd.h.

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

Definition at line 5430 of file simd.h.

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

Definition at line 5448 of file simd.h.

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

Definition at line 5453 of file simd.h.

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

Definition at line 5580 of file simd.h.

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

Definition at line 5511 of file simd.h.

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

Stream output.

Definition at line 5605 of file simd.h.

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

Definition at line 5522 of file simd.h.

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

Definition at line 5599 of file simd.h.

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

Definition at line 5550 of file simd.h.

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

Definition at line 5568 of file simd.h.

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

Definition at line 5593 of file simd.h.

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

Definition at line 5526 of file simd.h.

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

Definition at line 5536 of file simd.h.

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

Definition at line 5491 of file simd.h.

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

Definition at line 5499 of file simd.h.

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

Definition at line 5481 of file simd.h.

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

Definition at line 5489 of file simd.h.

vint8 operator~ ( const vint8 a)
friend

Definition at line 5502 of file simd.h.

Member Data Documentation

vint4 simd::vint8::m_4[2]

Definition at line 1468 of file simd.h.

simd_t simd::vint8::m_simd

Definition at line 1466 of file simd.h.

value_t simd::vint8::m_val[elements]

Definition at line 1467 of file simd.h.


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