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

#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
 
const value_tdata () const
 Return a pointer to the underlying scalar type. More...
 
value_tdata ()
 
 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 vfloat16operator= (float a)
 Assign a single value to all components. More...
 
const vfloat16operator= (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 percision vfloat8. More...
 
vfloat8 hi () const
 Extract the higher percision 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 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 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]
 
}; 
 

Friends

vfloat16 operator+ (const vfloat16 &a, const vfloat16 &b)
 
vfloat16 operator- (const vfloat16 &a)
 
vfloat16 operator- (const vfloat16 &a, const vfloat16 &b)
 
vfloat16 operator* (const vfloat16 &a, const vfloat16 &b)
 
vfloat16 operator/ (const vfloat16 &a, const vfloat16 &b)
 
vfloat16 operator% (const vfloat16 &a, const vfloat16 &b)
 
const vfloat16operator+= (vfloat16 &a, const vfloat16 &b)
 
const vfloat16operator-= (vfloat16 &a, const vfloat16 &b)
 
const vfloat16operator*= (vfloat16 &a, const vfloat16 &b)
 
const vfloat16operator/= (vfloat16 &a, const vfloat16 &b)
 
vbool16 operator== (const vfloat16 &a, const vfloat16 &b)
 
vbool16 operator!= (const vfloat16 &a, const vfloat16 &b)
 
vbool16 operator< (const vfloat16 &a, const vfloat16 &b)
 
vbool16 operator> (const vfloat16 &a, const vfloat16 &b)
 
vbool16 operator>= (const vfloat16 &a, const vfloat16 &b)
 
vbool16 operator<= (const vfloat16 &a, const vfloat16 &b)
 
std::ostream & operator<< (std::ostream &cout, const vfloat16 &val)
 Stream output. More...
 

Detailed Description

Floating point 16-vector, accelerated by SIMD instructions when available.

Definition at line 2691 of file simd.h.

Member Typedef Documentation

Definition at line 2703 of file simd.h.

Definition at line 2702 of file simd.h.

the native SIMD type used

Definition at line 2698 of file simd.h.

typedef float simd::vfloat16::value_t

Underlying equivalent scalar value type.

Definition at line 2694 of file simd.h.

SIMD bool type.

Definition at line 2701 of file simd.h.

SIMD int type.

Definition at line 2699 of file simd.h.

SIMD int type.

Definition at line 2700 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2695 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2696 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2697 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat16::vfloat16 ( )
inline

Default constructor (contents undefined)

Definition at line 2706 of file simd.h.

simd::vfloat16::vfloat16 ( float  a)
inline

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

Definition at line 2709 of file simd.h.

OIIO_FORCEINLINE simd::vfloat16::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.

Definition at line 8942 of file simd.h.

simd::vfloat16::vfloat16 ( const float *  f)
inline

Construct from a pointer to 16 values.

Definition at line 2718 of file simd.h.

simd::vfloat16::vfloat16 ( const vfloat16 other)
inline

Copy construct from another vfloat16.

Definition at line 2721 of file simd.h.

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

Construct from an int vector (promoting all components to float)

Definition at line 8973 of file simd.h.

OIIO_FORCEINLINE simd::vfloat16::vfloat16 ( const vfloat8 lo,
const vfloat8 hi 
)

Construct from two vfloat8's.

Definition at line 8950 of file simd.h.

OIIO_FORCEINLINE simd::vfloat16::vfloat16 ( const vfloat4 a,
const vfloat4 b,
const vfloat4 c,
const vfloat4 d 
)

Construct from four vfloat4's.

Definition at line 8960 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 2733 of file simd.h.

simd::vfloat16::vfloat16 ( const unsigned short *  vals)
inlineexplicit

Construct from a pointer to unsigned short values.

Definition at line 2744 of file simd.h.

simd::vfloat16::vfloat16 ( const short *  vals)
inlineexplicit

Construct from a pointer to short values.

Definition at line 2747 of file simd.h.

simd::vfloat16::vfloat16 ( const unsigned char *  vals)
inlineexplicit

Construct from a pointer to unsigned char values.

Definition at line 2750 of file simd.h.

simd::vfloat16::vfloat16 ( const char *  vals)
inlineexplicit

Construct from a pointer to char values.

Definition at line 2753 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat16::clear ( )

Set all components to 0.0.

Definition at line 9002 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2740 of file simd.h.

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

Definition at line 2741 of file simd.h.

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

Definition at line 9202 of file simd.h.

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

Definition at line 2864 of file simd.h.

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

Definition at line 9214 of file simd.h.

OIIO_FORCEINLINE vfloat8 simd::vfloat16::hi ( ) const

Extract the higher percision vfloat8.

Definition at line 8933 of file simd.h.

OIIO_FORCEINLINE const vfloat16 simd::vfloat16::Iota ( float  start = 0.0f,
float  step = 1.0f 
)
static

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

Definition at line 8994 of file simd.h.

OIIO_FORCEINLINE vfloat8 simd::vfloat16::lo ( ) const

Extract the lower percision vfloat8.

Definition at line 8925 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::load ( float  val)

Helper: load a single value into all components.

Definition at line 9011 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::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.

Definition at line 9021 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::load ( const float *  values)

Load from an array of values.

Definition at line 9049 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::load ( const float *  values,
int  n 
)

Load from a partial array of <=16 values. Unassigned values are undefined.

Definition at line 9059 of file simd.h.

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

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

Definition at line 9076 of file simd.h.

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

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

Definition at line 9087 of file simd.h.

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

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

Definition at line 9098 of file simd.h.

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

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

Definition at line 9108 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::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 9179 of file simd.h.

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

Definition at line 2850 of file simd.h.

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

Return a vfloat16 with all components set to 1.0.

Definition at line 8990 of file simd.h.

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

Return the raw SIMD type.

Definition at line 2736 of file simd.h.

const vfloat16& simd::vfloat16::operator= ( float  a)
inline

Assign a single value to all components.

Definition at line 2761 of file simd.h.

const vfloat16& simd::vfloat16::operator= ( vfloat16  other)
inline

Assign a vfloat16.

Definition at line 2764 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat16::operator[] ( int  i) const

Component access (get)

Definition at line 8911 of file simd.h.

OIIO_FORCEINLINE float & simd::vfloat16::operator[] ( int  i)

Component access (set)

Definition at line 8906 of file simd.h.

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

Definition at line 9226 of file simd.h.

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

Definition at line 2875 of file simd.h.

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

Definition at line 9238 of file simd.h.

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

Definition at line 9436 of file simd.h.

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

Definition at line 9433 of file simd.h.

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

Definition at line 9434 of file simd.h.

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

Definition at line 9435 of file simd.h.

void simd::vfloat16::setcomp ( int  i,
float  value 
)

Component access (set).

simd_t simd::vfloat16::simd ( ) const
inline

Definition at line 2737 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::store ( float *  values) const

Definition at line 9133 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::store ( float *  values,
int  n 
) const

Store the first n values into memory.

Definition at line 9146 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat16::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 9189 of file simd.h.

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

Definition at line 2855 of file simd.h.

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

Definition at line 2693 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat16::w ( ) const

Definition at line 9432 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat16::x ( ) const

Definition at line 9422 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat16::y ( ) const

Definition at line 9430 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat16::z ( ) const

Definition at line 9431 of file simd.h.

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

Return a vfloat16 with all components set to 0.0.

Definition at line 8982 of file simd.h.

Friends And Related Function Documentation

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

Definition at line 9318 of file simd.h.

vfloat16 operator% ( const vfloat16 a,
const vfloat16 b 
)
friend
vfloat16 operator* ( const vfloat16 a,
const vfloat16 b 
)
friend

Definition at line 9284 of file simd.h.

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

Definition at line 9292 of file simd.h.

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

Definition at line 9251 of file simd.h.

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

Definition at line 9259 of file simd.h.

vfloat16 operator- ( const vfloat16 a)
friend

Definition at line 9263 of file simd.h.

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

Definition at line 9271 of file simd.h.

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

Definition at line 9279 of file simd.h.

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

Definition at line 9296 of file simd.h.

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

Definition at line 9304 of file simd.h.

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

Definition at line 9327 of file simd.h.

std::ostream& operator<< ( std::ostream &  cout,
const vfloat16 val 
)
friend

Stream output.

Definition at line 8917 of file simd.h.

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

Definition at line 9354 of file simd.h.

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

Definition at line 9309 of file simd.h.

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

Definition at line 9336 of file simd.h.

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

Definition at line 9345 of file simd.h.

Member Data Documentation

union { ... }
vfloat8 simd::vfloat16::m_8[2]

Definition at line 2909 of file simd.h.

simd_t simd::vfloat16::m_simd

Definition at line 2907 of file simd.h.

value_t simd::vfloat16::m_val[paddedelements]

Definition at line 2908 of file simd.h.


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