HDK
|
#include <simd.h>
Public Types | |
enum | { elements = 16 } |
enum | { paddedelements = 16 } |
enum | { bits = elements*32 } |
typedef float | value_t |
Underlying equivalent scalar value type. More... | |
typedef simd_raw_t< float, 16 > ::type | simd_t |
the native SIMD type used More... | |
typedef vfloat16 | vfloat_t |
SIMD int type. More... | |
typedef vint16 | vint_t |
SIMD int type. More... | |
typedef vbool16 | vbool_t |
SIMD bool type. More... | |
typedef vint16 | int_t |
typedef vbool16 | bool_t |
Public Member Functions | |
vfloat16 () | |
Default constructor (contents undefined) More... | |
vfloat16 (float a) | |
Construct from a single value (store it in all slots) More... | |
vfloat16 (float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9, float v10, float v11, float v12, float v13, float v14, float v15) | |
Construct from 16 values. More... | |
vfloat16 (const float *f) | |
Construct from a pointer to 16 values. More... | |
vfloat16 (const vfloat16 &other) | |
Copy construct from another vfloat16. More... | |
vfloat16 (const vint16 &ival) | |
Construct from an int vector (promoting all components to float) More... | |
vfloat16 (const vfloat8 &lo, const vfloat8 &hi) | |
Construct from two vfloat8's. More... | |
vfloat16 (const vfloat4 &a, const vfloat4 &b, const vfloat4 &c, const vfloat4 &d) | |
Construct from four vfloat4's. More... | |
vfloat16 (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_t & | simd () |
const value_t * | data () const |
Return a pointer to the underlying scalar type. More... | |
value_t * | data () |
vfloat16 (const unsigned short *vals) | |
Construct from a pointer to unsigned short values. More... | |
vfloat16 (const short *vals) | |
Construct from a pointer to short values. More... | |
vfloat16 (const unsigned char *vals) | |
Construct from a pointer to unsigned char values. More... | |
vfloat16 (const char *vals) | |
Construct from a pointer to char values. More... | |
const vfloat16 & | operator= (float a) |
Assign a single value to all components. More... | |
const vfloat16 & | operator= (vfloat16 other) |
Assign a vfloat16. More... | |
void | clear () |
Set all components to 0.0. More... | |
float | operator[] (int i) const |
Component access (get) More... | |
float & | operator[] (int i) |
Component access (set) More... | |
void | setcomp (int i, float 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) |
vfloat8 | lo () const |
Extract the lower precision vfloat8. More... | |
vfloat8 | hi () const |
Extract the higher precision vfloat8. More... | |
void | load (float val) |
Helper: load a single value into all components. More... | |
void | load (float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9, float v10, float v11, float v12, float v13, float v14, float v15) |
Load separate values into each component. More... | |
void | load (const float *values) |
Load from an array of values. More... | |
void | load (const float *values, int n) |
void | load (const unsigned short *values) |
Load from an array of 16 unsigned short values, convert to float. More... | |
void | load (const short *values) |
Load from an array of 16 short values, convert to float. More... | |
void | load (const unsigned char *values) |
Load from an array of 16 unsigned char values, convert to float. More... | |
void | load (const char *values) |
Load from an array of 16 char values, convert to float. More... | |
void | store (float *values) const |
void | store (float *values, int n) const |
Store the first n values into memory. More... | |
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 const vfloat16 | Zero () |
Return a vfloat16 with all components set to 0.0. More... | |
static const vfloat16 | One () |
Return a vfloat16 with all components set to 1.0. More... | |
static const vfloat16 | Iota (float start=0.0f, float step=1.0f) |
Protected Attributes | |
union { | |
simd_t m_simd | |
value_t m_val [paddedelements] | |
vfloat8 m_8 [2] | |
}; | |
Floating point 16-vector, accelerated by SIMD instructions when available.
typedef vbool16 simd::vfloat16::bool_t |
typedef vint16 simd::vfloat16::int_t |
typedef simd_raw_t<float,16>::type simd::vfloat16::simd_t |
typedef float simd::vfloat16::value_t |
typedef vbool16 simd::vfloat16::vbool_t |
typedef vfloat16 simd::vfloat16::vfloat_t |
typedef vint16 simd::vfloat16::vint_t |
|
inline |
|
inline |
|
inline |
|
inline |
|
explicit |
OIIO_FORCEINLINE simd::vfloat16::vfloat16 | ( | const vfloat8 & | lo, |
const vfloat8 & | hi | ||
) |
OIIO_FORCEINLINE simd::vfloat16::vfloat16 | ( | const vfloat4 & | a, |
const vfloat4 & | b, | ||
const vfloat4 & | c, | ||
const vfloat4 & | d | ||
) |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
OIIO_FORCEINLINE void simd::vfloat16::clear | ( | ) |
|
inline |
void simd::vfloat16::gather | ( | const value_t * | baseptr, |
const vint_t & | vindex | ||
) |
Load values from addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vfloat16::gather | ( | const value_t * | baseptr, |
const vint_t & | vindex | ||
) |
void simd::vfloat16::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
Gather elements defined by the mask, leave others unchanged.
OIIO_FORCEINLINE void simd::vfloat16::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
OIIO_FORCEINLINE vfloat8 simd::vfloat16::hi | ( | ) | const |
|
static |
OIIO_FORCEINLINE vfloat8 simd::vfloat16::lo | ( | ) | const |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | float | val | ) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const float * | values | ) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const float * | values, |
int | n | ||
) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const unsigned short * | values | ) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const short * | values | ) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const unsigned char * | values | ) |
OIIO_FORCEINLINE void simd::vfloat16::load | ( | const char * | values | ) |
OIIO_FORCEINLINE void simd::vfloat16::load_mask | ( | const vbool_t & | mask, |
const value_t * | values | ||
) |
|
static |
|
inline |
OIIO_FORCEINLINE float simd::vfloat16::operator[] | ( | int | i | ) | const |
OIIO_FORCEINLINE float & simd::vfloat16::operator[] | ( | int | i | ) |
void simd::vfloat16::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
Store values at addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vfloat16::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
void simd::vfloat16::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
Scatter elements defined by the mask.
OIIO_FORCEINLINE void simd::vfloat16::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat16::set_w | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat16::set_x | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat16::set_y | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat16::set_z | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat16::store | ( | float * | values | ) | const |
OIIO_FORCEINLINE void simd::vfloat16::store | ( | float * | values, |
int | n | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat16::store_mask | ( | const vbool_t & | mask, |
value_t * | values | ||
) | const |
|
inlinestatic |
OIIO_FORCEINLINE float simd::vfloat16::w | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat16::x | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat16::y | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat16::z | ( | ) | const |
|
static |
|
friend |
union { ... } |
value_t simd::vfloat16::m_val[paddedelements] |