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
 
simd_tsimd ()
 
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...
 
floatoperator[] (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]
 
}; 
 

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, float b)
 
vfloat16 operator* (float 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 2757 of file simd.h.

Member Typedef Documentation

Definition at line 2771 of file simd.h.

Definition at line 2769 of file simd.h.

the native SIMD type used

Definition at line 2764 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 2760 of file simd.h.

SIMD bool type.

Definition at line 2767 of file simd.h.

SIMD int type.

Definition at line 2765 of file simd.h.

SIMD int type.

Definition at line 2766 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2761 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2762 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2763 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat16::vfloat16 ( )
inline

Default constructor (contents undefined)

Definition at line 2774 of file simd.h.

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

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

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

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

Construct from a pointer to 16 values.

Definition at line 2786 of file simd.h.

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

Copy construct from another vfloat16.

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

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

Construct from two vfloat8's.

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

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

Construct from the underlying SIMD type.

Definition at line 2801 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 2813 of file simd.h.

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

Construct from a pointer to short values.

Definition at line 2816 of file simd.h.

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

Construct from a pointer to unsigned char values.

Definition at line 2819 of file simd.h.

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

Construct from a pointer to char values.

Definition at line 2822 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat16::clear ( )

Set all components to 0.0.

Definition at line 9381 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2809 of file simd.h.

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

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

template<int scale = 4>
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.

template<int scale = 4>
void simd::vfloat16::gather_mask ( int  mask,
const value_t baseptr,
const vint_t vindex 
)
inline

Definition at line 2933 of file simd.h.

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

Definition at line 9593 of file simd.h.

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

Extract the higher precision vfloat8.

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

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

Extract the lower precision vfloat8.

Definition at line 9304 of file simd.h.

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

Helper: load a single value into all components.

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

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

Load from an array of values.

Definition at line 9428 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 9438 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 9455 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 9466 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 9477 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 9487 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 9558 of file simd.h.

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

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

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

Return the raw SIMD type.

Definition at line 2804 of file simd.h.

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

Assign a single value to all components.

Definition at line 2830 of file simd.h.

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

Assign a vfloat16.

Definition at line 2833 of file simd.h.

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

Component access (get)

Definition at line 9290 of file simd.h.

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

Component access (set)

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

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

Definition at line 2944 of file simd.h.

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

Definition at line 9617 of file simd.h.

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

Definition at line 9827 of file simd.h.

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

Definition at line 9824 of file simd.h.

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

Definition at line 9825 of file simd.h.

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

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

simd_t& simd::vfloat16::simd ( )
inline

Definition at line 2806 of file simd.h.

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

Definition at line 9512 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 9525 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 9568 of file simd.h.

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

Definition at line 2924 of file simd.h.

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

Definition at line 2759 of file simd.h.

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

Definition at line 9823 of file simd.h.

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

Definition at line 9813 of file simd.h.

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

Definition at line 9821 of file simd.h.

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

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

Friends And Related Function Documentation

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

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

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

Definition at line 9663 of file simd.h.

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

Definition at line 9671 of file simd.h.

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

Definition at line 9683 of file simd.h.

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

Definition at line 9630 of file simd.h.

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

Definition at line 9638 of file simd.h.

vfloat16 operator- ( const vfloat16 a)
friend

Definition at line 9642 of file simd.h.

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

Definition at line 9650 of file simd.h.

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

Definition at line 9658 of file simd.h.

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

Definition at line 9687 of file simd.h.

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

Definition at line 9695 of file simd.h.

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

Definition at line 9718 of file simd.h.

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

Stream output.

Definition at line 9296 of file simd.h.

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

Definition at line 9745 of file simd.h.

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

Definition at line 9700 of file simd.h.

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

Definition at line 9727 of file simd.h.

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

Definition at line 9736 of file simd.h.

Member Data Documentation

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

Definition at line 2980 of file simd.h.

simd_t simd::vfloat16::m_simd

Definition at line 2978 of file simd.h.

value_t simd::vfloat16::m_val[paddedelements]

Definition at line 2979 of file simd.h.


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