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

#include <simd.h>

Public Types

enum  { elements = 8 }
 
enum  { paddedelements = 8 }
 
enum  { bits = elements*32 }
 
typedef float value_t
 Underlying equivalent scalar value type. More...
 
typedef simd_raw_t< float, 8 >
::type 
simd_t
 the native SIMD type used More...
 
typedef vfloat8 vfloat_t
 SIMD int type. More...
 
typedef vint8 vint_t
 SIMD int type. More...
 
typedef vbool8 vbool_t
 SIMD bool type. More...
 
typedef vint8 int_t
 
typedef vbool8 bool_t
 

Public Member Functions

 vfloat8 ()
 Default constructor (contents undefined) More...
 
 vfloat8 (float a)
 Construct from a single value (store it in all slots) More...
 
 vfloat8 (float a, float b, float c, float d, float e, float f, float g, float h)
 Construct from 8 values. More...
 
 vfloat8 (const float *f)
 Construct from a pointer to 8 values. More...
 
 vfloat8 (const vfloat8 &other)
 Copy construct from another vfloat8. More...
 
 vfloat8 (const vint8 &ival)
 Construct from an int vector (promoting all components to float) More...
 
 vfloat8 (const vfloat4 &lo, const vfloat4 &hi)
 Construct from two vfloat4's. More...
 
 vfloat8 (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 ()
 
 vfloat8 (const unsigned short *vals)
 Construct from a pointer to unsigned short values. More...
 
 vfloat8 (const short *vals)
 Construct from a pointer to short values. More...
 
 vfloat8 (const unsigned char *vals)
 Construct from a pointer to unsigned char values. More...
 
 vfloat8 (const char *vals)
 Construct from a pointer to char values. More...
 
const vfloat8operator= (float a)
 Assign a single value to all components. More...
 
const vfloat8operator= (vfloat8 other)
 Assign a vfloat8. 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)
 
vfloat4 lo () const
 Extract the lower precision vfloat4. More...
 
vfloat4 hi () const
 Extract the higher precision vfloat4. More...
 
void load (float val)
 Helper: load a single value into all components. More...
 
void load (float a, float b, float c, float d, float e, float f, float g, float h)
 Helper: load 8 values. 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 8 unsigned short values, convert to float. More...
 
void load (const short *values)
 Load from an array of 8 short values, convert to float. More...
 
void load (const unsigned char *values)
 Load from an array of 8 unsigned char values, convert to float. More...
 
void load (const char *values)
 Load from an array of 8 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 (int mask, const value_t *values)
 
void load_mask (const vbool_t &mask, const value_t *values)
 
void store_mask (int mask, value_t *values) const
 
void store_mask (const vbool_t &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)
 
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 vfloat8 Zero ()
 Return a vfloat8 with all components set to 0.0. More...
 
static const vfloat8 One ()
 Return a vfloat8 with all components set to 1.0. More...
 
static const vfloat8 Iota (float start=0.0f, float step=1.0f)
 

Protected Attributes

union {
   simd_t   m_simd
 
   value_t   m_val [paddedelements]
 
   vfloat4   m_4 [2]
 
}; 
 

Friends

vfloat8 operator+ (const vfloat8 &a, const vfloat8 &b)
 
vfloat8 operator- (const vfloat8 &a)
 
vfloat8 operator- (const vfloat8 &a, const vfloat8 &b)
 
vfloat8 operator* (const vfloat8 &a, const vfloat8 &b)
 
vfloat8 operator* (const vfloat8 &a, float b)
 
vfloat8 operator* (float a, const vfloat8 &b)
 
vfloat8 operator/ (const vfloat8 &a, const vfloat8 &b)
 
vfloat8 operator% (const vfloat8 &a, const vfloat8 &b)
 
const vfloat8operator+= (vfloat8 &a, const vfloat8 &b)
 
const vfloat8operator-= (vfloat8 &a, const vfloat8 &b)
 
const vfloat8operator*= (vfloat8 &a, const vfloat8 &b)
 
const vfloat8operator/= (vfloat8 &a, const vfloat8 &b)
 
vbool8 operator== (const vfloat8 &a, const vfloat8 &b)
 
vbool8 operator!= (const vfloat8 &a, const vfloat8 &b)
 
vbool8 operator< (const vfloat8 &a, const vfloat8 &b)
 
vbool8 operator> (const vfloat8 &a, const vfloat8 &b)
 
vbool8 operator>= (const vfloat8 &a, const vfloat8 &b)
 
vbool8 operator<= (const vfloat8 &a, const vfloat8 &b)
 
std::ostream & operator<< (std::ostream &cout, const vfloat8 &val)
 Stream output. More...
 

Detailed Description

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

Definition at line 2543 of file simd.h.

Member Typedef Documentation

Definition at line 2557 of file simd.h.

Definition at line 2555 of file simd.h.

the native SIMD type used

Definition at line 2550 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 2546 of file simd.h.

SIMD bool type.

Definition at line 2553 of file simd.h.

SIMD int type.

Definition at line 2551 of file simd.h.

SIMD int type.

Definition at line 2552 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2547 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2548 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2549 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat8::vfloat8 ( )
inline

Default constructor (contents undefined)

Definition at line 2561 of file simd.h.

simd::vfloat8::vfloat8 ( float  a)
inline

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

Definition at line 2564 of file simd.h.

simd::vfloat8::vfloat8 ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
float  g,
float  h 
)
inline

Construct from 8 values.

Definition at line 2567 of file simd.h.

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

Construct from a pointer to 8 values.

Definition at line 2571 of file simd.h.

simd::vfloat8::vfloat8 ( const vfloat8 other)
inline

Copy construct from another vfloat8.

Definition at line 2574 of file simd.h.

OIIO_FORCEINLINE simd::vfloat8::vfloat8 ( const vint8 ival)
explicit

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

Definition at line 8692 of file simd.h.

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

Construct from two vfloat4's.

Definition at line 8679 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 2583 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 2595 of file simd.h.

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

Construct from a pointer to short values.

Definition at line 2598 of file simd.h.

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

Construct from a pointer to unsigned char values.

Definition at line 2601 of file simd.h.

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

Construct from a pointer to char values.

Definition at line 2604 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat8::clear ( )

Set all components to 0.0.

Definition at line 8719 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2591 of file simd.h.

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

Definition at line 2592 of file simd.h.

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

Definition at line 8963 of file simd.h.

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

Definition at line 8974 of file simd.h.

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

Extract the higher precision vfloat4.

Definition at line 8670 of file simd.h.

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

Return a vfloat8 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 8713 of file simd.h.

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

Extract the lower precision vfloat4.

Definition at line 8662 of file simd.h.

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

Helper: load a single value into all components.

Definition at line 8729 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat8::load ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
float  g,
float  h 
)

Helper: load 8 values.

Definition at line 8740 of file simd.h.

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

Load from an array of values.

Definition at line 8760 of file simd.h.

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

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

Definition at line 8772 of file simd.h.

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

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

Definition at line 8802 of file simd.h.

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

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

Definition at line 8815 of file simd.h.

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

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

Definition at line 8828 of file simd.h.

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

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

Definition at line 8840 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat8::load_mask ( int  mask,
const value_t values 
)

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

Definition at line 8917 of file simd.h.

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

Definition at line 8928 of file simd.h.

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

Return a vfloat8 with all components set to 1.0.

Definition at line 8709 of file simd.h.

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

Return the raw SIMD type.

Definition at line 2586 of file simd.h.

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

Assign a single value to all components.

Definition at line 2612 of file simd.h.

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

Assign a vfloat8.

Definition at line 2615 of file simd.h.

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

Component access (get)

Definition at line 8648 of file simd.h.

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

Component access (set)

Definition at line 8643 of file simd.h.

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

Definition at line 8985 of file simd.h.

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

Definition at line 8996 of file simd.h.

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

Definition at line 9190 of file simd.h.

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

Definition at line 9187 of file simd.h.

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

Definition at line 9188 of file simd.h.

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

Definition at line 9189 of file simd.h.

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

Component access (set).

simd_t simd::vfloat8::simd ( ) const
inline

Definition at line 2587 of file simd.h.

simd_t& simd::vfloat8::simd ( )
inline

Definition at line 2588 of file simd.h.

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

Definition at line 2558 of file simd.h.

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

Definition at line 8867 of file simd.h.

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

Store the first n values into memory.

Definition at line 8882 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat8::store_mask ( int  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 8939 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat8::store_mask ( const vbool_t mask,
value_t values 
) const

Definition at line 8950 of file simd.h.

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

Definition at line 2545 of file simd.h.

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

Definition at line 9186 of file simd.h.

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

Definition at line 9183 of file simd.h.

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

Definition at line 9184 of file simd.h.

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

Definition at line 9185 of file simd.h.

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

Return a vfloat8 with all components set to 0.0.

Definition at line 8701 of file simd.h.

Friends And Related Function Documentation

vbool8 operator!= ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9084 of file simd.h.

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

Definition at line 9052 of file simd.h.

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

Definition at line 9040 of file simd.h.

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

Definition at line 9048 of file simd.h.

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

Definition at line 9060 of file simd.h.

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

Definition at line 9008 of file simd.h.

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

Definition at line 9016 of file simd.h.

vfloat8 operator- ( const vfloat8 a)
friend

Definition at line 9020 of file simd.h.

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

Definition at line 9028 of file simd.h.

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

Definition at line 9036 of file simd.h.

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

Definition at line 9064 of file simd.h.

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

Definition at line 9072 of file simd.h.

vbool8 operator< ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9092 of file simd.h.

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

Stream output.

Definition at line 8654 of file simd.h.

vbool8 operator<= ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9116 of file simd.h.

vbool8 operator== ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9076 of file simd.h.

vbool8 operator> ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9100 of file simd.h.

vbool8 operator>= ( const vfloat8 a,
const vfloat8 b 
)
friend

Definition at line 9108 of file simd.h.

Member Data Documentation

union { ... }
vfloat4 simd::vfloat8::m_4[2]

Definition at line 2756 of file simd.h.

simd_t simd::vfloat8::m_simd

Definition at line 2754 of file simd.h.

value_t simd::vfloat8::m_val[paddedelements]

Definition at line 2755 of file simd.h.


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