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

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

#include <simd.h>

Public Types

enum  { elements = 16 }
 
enum  { paddedelements =16 }
 
enum  { bits = 128 }
 
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 vbool16 vbool_t
 bool type of the same length More...
 
typedef vfloat16 vfloat_t
 float type of the same length More...
 
typedef vint16 vint_t
 int type of the same length More...
 
typedef vbool16 bool_t
 
typedef vfloat16 float_t
 

Public Member Functions

 vint16 ()
 Default constructor (contents undefined) More...
 
 vint16 (int a)
 Construct from a single value (store it in all slots) More...
 
 vint16 (int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15)
 Construct from 16 values (won't work for vint16) More...
 
 vint16 (const int *vals)
 Construct from a pointer to values. More...
 
 vint16 (const unsigned short *vals)
 Construct from a pointer to unsigned short values. More...
 
 vint16 (const short *vals)
 Construct from a pointer to signed short values. More...
 
 vint16 (const unsigned char *vals)
 Construct from a pointer to unsigned char values (0 - 255) More...
 
 vint16 (const char *vals)
 Construct from a pointer to signed char values (-128 - 127) More...
 
 vint16 (const vint16 &other)
 Copy construct from another vint16. More...
 
 vint16 (const vfloat16 &f)
 Convert a vfloat16 to an vint16. Equivalent to i = (int)f;. More...
 
 vint16 (const vint8 &lo, const vint8 &hi)
 Construct from two vint8's. More...
 
 vint16 (const vint4 &a, const vint4 &b, const vint4 &c, const vint4 &d)
 Construct from four vint4's. More...
 
 vint16 (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 vint16operator= (int a)
 Assign one value to all components. More...
 
const vint16operator= (const vint16 &other)
 Assignment from another vint16. 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)
 
vint8 lo () const
 Extract the lower precision vint8. More...
 
vint8 hi () const
 Extract the higher precision vint8. More...
 
void load (int a)
 Helper: load a single int into all components. More...
 
void load (int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15)
 Load separate values into each component. More...
 
void load (const int *values)
 Load from an array of 16 values. More...
 
void load (const int *values, int n)
 
void load (const unsigned short *values)
 Load from an array of 16 unsigned short values, convert to vint16. More...
 
void load (const short *values)
 Load from an array of 16 unsigned short values, convert to vint16. More...
 
void load (const unsigned char *values)
 Load from an array of 16 unsigned char values, convert to vint16. More...
 
void load (const char *values)
 Load from an array of 16 unsigned char values, convert to vint16. 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 (const vbool_t &mask, const value_t *values)
 
void load_mask (int mask, const value_t *values)
 
void store_mask (const vbool_t &mask, value_t *values) const
 
void store_mask (int 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 vint16 Zero ()
 Return an vint16 with all components set to 0. More...
 
static const vint16 One ()
 Return an vint16 with all components set to 1. More...
 
static const vint16 NegOne ()
 Return an vint16 with all components set to -1 (aka 0xffffffff) More...
 
static const vint16 Iota (int start=0, int step=1)
 
static const vint16 Giota ()
 Return an vint16 with "geometric" iota: (1, 2, 4, 8, ...). More...
 

Friends

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

Detailed Description

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

Definition at line 1548 of file simd.h.

Member Typedef Documentation

Definition at line 1560 of file simd.h.

Definition at line 1562 of file simd.h.

the native SIMD type used

Definition at line 1555 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 1551 of file simd.h.

bool type of the same length

Definition at line 1556 of file simd.h.

float type of the same length

Definition at line 1557 of file simd.h.

int type of the same length

Definition at line 1558 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 1552 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 1553 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 1554 of file simd.h.

Constructor & Destructor Documentation

simd::vint16::vint16 ( )
inline

Default constructor (contents undefined)

Definition at line 1566 of file simd.h.

OIIO_FORCEINLINE simd::vint16::vint16 ( int  a)

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

Definition at line 6020 of file simd.h.

OIIO_FORCEINLINE simd::vint16::vint16 ( int  v0,
int  v1,
int  v2,
int  v3,
int  v4,
int  v5,
int  v6,
int  v7,
int  v8,
int  v9,
int  v10,
int  v11,
int  v12,
int  v13,
int  v14,
int  v15 
)

Construct from 16 values (won't work for vint16)

Definition at line 6022 of file simd.h.

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

Construct from a pointer to values.

Definition at line 6030 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 6031 of file simd.h.

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

Construct from a pointer to signed short values.

Definition at line 6032 of file simd.h.

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

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

Definition at line 6033 of file simd.h.

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

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

Definition at line 6034 of file simd.h.

simd::vint16::vint16 ( const vint16 other)
inline

Copy construct from another vint16.

Definition at line 1591 of file simd.h.

OIIO_FORCEINLINE simd::vint16::vint16 ( const vfloat16 f)
explicit

Convert a vfloat16 to an vint16. Equivalent to i = (int)f;.

Definition at line 9991 of file simd.h.

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

Construct from two vint8's.

Definition at line 6171 of file simd.h.

OIIO_FORCEINLINE simd::vint16::vint16 ( const vint4 a,
const vint4 b,
const vint4 c,
const vint4 d 
)

Construct from four vint4's.

Definition at line 6182 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 1603 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vint16::clear ( )

Sset all components to 0.

Definition at line 6118 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 1611 of file simd.h.

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

Definition at line 1612 of file simd.h.

template<int scale = 4>
void simd::vint16::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::vint16::gather ( const value_t baseptr,
const vint_t vindex 
)

Definition at line 6061 of file simd.h.

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

Definition at line 1718 of file simd.h.

template<int scale>
OIIO_FORCEINLINE void simd::vint16::gather_mask ( const vbool_t mask,
const value_t baseptr,
const vint_t vindex 
)

Definition at line 6072 of file simd.h.

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

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

Definition at line 6148 of file simd.h.

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

Extract the higher precision vint8.

Definition at line 6162 of file simd.h.

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

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

Definition at line 6140 of file simd.h.

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

Extract the lower precision vint8.

Definition at line 6154 of file simd.h.

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

Helper: load a single int into all components.

Definition at line 5918 of file simd.h.

OIIO_FORCEINLINE void simd::vint16::load ( int  v0,
int  v1,
int  v2,
int  v3,
int  v4,
int  v5,
int  v6,
int  v7,
int  v8,
int  v9,
int  v10,
int  v11,
int  v12,
int  v13,
int  v14,
int  v15 
)

Load separate values into each component.

Definition at line 5928 of file simd.h.

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

Load from an array of 16 values.

Definition at line 5956 of file simd.h.

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

Definition at line 5966 of file simd.h.

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

Load from an array of 16 unsigned short values, convert to vint16.

Definition at line 5991 of file simd.h.

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

Load from an array of 16 unsigned short values, convert to vint16.

Definition at line 5982 of file simd.h.

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

Load from an array of 16 unsigned char values, convert to vint16.

Definition at line 6010 of file simd.h.

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

Load from an array of 16 unsigned char values, convert to vint16.

Definition at line 6001 of file simd.h.

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

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

Definition at line 6039 of file simd.h.

void simd::vint16::load_mask ( int  mask,
const value_t values 
)
inline

Definition at line 1704 of file simd.h.

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

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

Definition at line 6137 of file simd.h.

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

Return an vint16 with all components set to 1.

Definition at line 6135 of file simd.h.

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

Return the raw SIMD type.

Definition at line 1606 of file simd.h.

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

Assign one value to all components.

Definition at line 6036 of file simd.h.

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

Assignment from another vint16.

Definition at line 5897 of file simd.h.

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

Component access (get)

Definition at line 5902 of file simd.h.

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

Component access (set)

Definition at line 5907 of file simd.h.

template<int scale = 4>
void simd::vint16::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::vint16::scatter ( value_t baseptr,
const vint_t vindex 
) const

Definition at line 6083 of file simd.h.

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

Definition at line 1729 of file simd.h.

template<int scale>
OIIO_FORCEINLINE void simd::vint16::scatter_mask ( const vbool_t mask,
value_t baseptr,
const vint_t vindex 
) const

Definition at line 6094 of file simd.h.

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

Definition at line 6516 of file simd.h.

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

Definition at line 6513 of file simd.h.

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

Definition at line 6514 of file simd.h.

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

Definition at line 6515 of file simd.h.

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

Component access (set).

Definition at line 5912 of file simd.h.

simd_t simd::vint16::simd ( ) const
inline

Definition at line 1607 of file simd.h.

simd_t& simd::vint16::simd ( )
inline

Definition at line 1608 of file simd.h.

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

Definition at line 1563 of file simd.h.

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

Store the values into memory.

Definition at line 6105 of file simd.h.

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

Store the first n values into memory.

Definition at line 6410 of file simd.h.

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

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

Definition at line 6428 of file simd.h.

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

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

Definition at line 6440 of file simd.h.

OIIO_FORCEINLINE void simd::vint16::store_mask ( const vbool_t 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 6049 of file simd.h.

void simd::vint16::store_mask ( int  mask,
value_t values 
) const
inline

Definition at line 1709 of file simd.h.

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

Definition at line 1550 of file simd.h.

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

Definition at line 6512 of file simd.h.

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

Definition at line 6502 of file simd.h.

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

Definition at line 6510 of file simd.h.

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

Definition at line 6511 of file simd.h.

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

Return an vint16 with all components set to 0.

Definition at line 6127 of file simd.h.

Friends And Related Function Documentation

vbool16 operator!= ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6356 of file simd.h.

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

Definition at line 6253 of file simd.h.

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

Definition at line 6258 of file simd.h.

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

Definition at line 6268 of file simd.h.

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

Definition at line 6276 of file simd.h.

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

Definition at line 6232 of file simd.h.

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

Definition at line 6241 of file simd.h.

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

Definition at line 6195 of file simd.h.

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

Definition at line 6204 of file simd.h.

vint16 operator- ( const vint16 a)
friend

Definition at line 6209 of file simd.h.

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

Definition at line 6218 of file simd.h.

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

Definition at line 6227 of file simd.h.

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

Definition at line 6245 of file simd.h.

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

Definition at line 6250 of file simd.h.

vbool16 operator< ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6374 of file simd.h.

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

Definition at line 6308 of file simd.h.

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

Stream output.

Definition at line 6401 of file simd.h.

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

Definition at line 6319 of file simd.h.

vbool16 operator<= ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6392 of file simd.h.

vbool16 operator== ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6347 of file simd.h.

vbool16 operator> ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6365 of file simd.h.

vbool16 operator>= ( const vint16 a,
const vint16 b 
)
friend

Definition at line 6383 of file simd.h.

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

Definition at line 6323 of file simd.h.

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

Definition at line 6332 of file simd.h.

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

Definition at line 6288 of file simd.h.

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

Definition at line 6296 of file simd.h.

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

Definition at line 6278 of file simd.h.

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

Definition at line 6286 of file simd.h.

vint16 operator~ ( const vint16 a)
friend

Definition at line 6299 of file simd.h.

Member Data Documentation

vint8 simd::vint16::m_8[2]

Definition at line 1773 of file simd.h.

simd_t simd::vint16::m_simd

Definition at line 1771 of file simd.h.

value_t simd::vint16::m_val[elements]

Definition at line 1772 of file simd.h.


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