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

Member Typedef Documentation

Definition at line 2878 of file simd.h.

Definition at line 2876 of file simd.h.

the native SIMD type used

Definition at line 2871 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 2867 of file simd.h.

SIMD bool type.

Definition at line 2874 of file simd.h.

SIMD int type.

Definition at line 2872 of file simd.h.

SIMD int type.

Definition at line 2873 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2868 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2869 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2870 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat16::vfloat16 ( )
inline

Default constructor (contents undefined)

Definition at line 2882 of file simd.h.

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

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

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

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

Construct from a pointer to 16 values.

Definition at line 2894 of file simd.h.

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

Copy construct from another vfloat16.

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

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

Construct from two vfloat8's.

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

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

Construct from the underlying SIMD type.

Definition at line 2909 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 2921 of file simd.h.

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

Construct from a pointer to short values.

Definition at line 2924 of file simd.h.

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

Construct from a pointer to unsigned char values.

Definition at line 2927 of file simd.h.

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

Construct from a pointer to char values.

Definition at line 2930 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat16::clear ( )

Set all components to 0.0.

Definition at line 9617 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2917 of file simd.h.

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

Definition at line 2918 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 9817 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 3041 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 9829 of file simd.h.

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

Extract the higher precision vfloat8.

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

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

Extract the lower precision vfloat8.

Definition at line 9540 of file simd.h.

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

Helper: load a single value into all components.

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

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

Load from an array of values.

Definition at line 9664 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 9674 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 9691 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 9702 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 9713 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 9723 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 9794 of file simd.h.

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

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

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

Return the raw SIMD type.

Definition at line 2912 of file simd.h.

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

Assign a single value to all components.

Definition at line 2938 of file simd.h.

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

Assign a vfloat16.

Definition at line 2941 of file simd.h.

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

Component access (get)

Definition at line 9526 of file simd.h.

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

Component access (set)

Definition at line 9521 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 9841 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 3052 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 9853 of file simd.h.

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

Definition at line 10063 of file simd.h.

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

Definition at line 10060 of file simd.h.

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

Definition at line 10061 of file simd.h.

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

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

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

Definition at line 2914 of file simd.h.

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

Definition at line 2879 of file simd.h.

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

Definition at line 9748 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 9761 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 9804 of file simd.h.

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

Definition at line 3032 of file simd.h.

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

Definition at line 2866 of file simd.h.

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

Definition at line 10059 of file simd.h.

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

Definition at line 10049 of file simd.h.

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

Definition at line 10057 of file simd.h.

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

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

Friends And Related Function Documentation

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

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

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

Definition at line 9899 of file simd.h.

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

Definition at line 9907 of file simd.h.

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

Definition at line 9919 of file simd.h.

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

Definition at line 9866 of file simd.h.

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

Definition at line 9874 of file simd.h.

vfloat16 operator- ( const vfloat16 a)
friend

Definition at line 9878 of file simd.h.

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

Definition at line 9886 of file simd.h.

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

Definition at line 9894 of file simd.h.

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

Definition at line 9923 of file simd.h.

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

Definition at line 9931 of file simd.h.

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

Definition at line 9954 of file simd.h.

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

Stream output.

Definition at line 9532 of file simd.h.

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

Definition at line 9981 of file simd.h.

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

Definition at line 9936 of file simd.h.

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

Definition at line 9963 of file simd.h.

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

Definition at line 9972 of file simd.h.

Member Data Documentation

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

Definition at line 3088 of file simd.h.

simd_t simd::vfloat16::m_simd

Definition at line 3086 of file simd.h.

value_t simd::vfloat16::m_val[paddedelements]

Definition at line 3087 of file simd.h.


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