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 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 2437 of file simd.h.

Member Typedef Documentation

Definition at line 2451 of file simd.h.

Definition at line 2449 of file simd.h.

the native SIMD type used

Definition at line 2444 of file simd.h.

Underlying equivalent scalar value type.

Definition at line 2440 of file simd.h.

SIMD bool type.

Definition at line 2447 of file simd.h.

SIMD int type.

Definition at line 2445 of file simd.h.

SIMD int type.

Definition at line 2446 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2441 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2442 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2443 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat8::vfloat8 ( )
inline

Default constructor (contents undefined)

Definition at line 2454 of file simd.h.

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

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

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

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

Construct from a pointer to 8 values.

Definition at line 2464 of file simd.h.

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

Copy construct from another vfloat8.

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

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

Construct from two vfloat4's.

Definition at line 8443 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 2476 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 2488 of file simd.h.

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

Construct from a pointer to short values.

Definition at line 2491 of file simd.h.

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

Construct from a pointer to unsigned char values.

Definition at line 2494 of file simd.h.

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

Construct from a pointer to char values.

Definition at line 2497 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat8::clear ( )

Set all components to 0.0.

Definition at line 8483 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2484 of file simd.h.

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

Definition at line 2485 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 8727 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 8738 of file simd.h.

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

Extract the higher precision vfloat4.

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

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

Extract the lower precision vfloat4.

Definition at line 8426 of file simd.h.

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

Helper: load a single value into all components.

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

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

Load from an array of values.

Definition at line 8524 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 8536 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 8566 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 8579 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 8592 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 8604 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 8681 of file simd.h.

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

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

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

Return the raw SIMD type.

Definition at line 2479 of file simd.h.

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

Assign a single value to all components.

Definition at line 2505 of file simd.h.

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

Assign a vfloat8.

Definition at line 2508 of file simd.h.

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

Component access (get)

Definition at line 8412 of file simd.h.

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

Component access (set)

Definition at line 8407 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 8749 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 8760 of file simd.h.

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

Definition at line 8954 of file simd.h.

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

Definition at line 8951 of file simd.h.

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

Definition at line 8952 of file simd.h.

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

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

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

Definition at line 2481 of file simd.h.

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

Definition at line 8631 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 8646 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 8703 of file simd.h.

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

Definition at line 8714 of file simd.h.

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

Definition at line 2439 of file simd.h.

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

Definition at line 8950 of file simd.h.

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

Definition at line 8947 of file simd.h.

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

Definition at line 8948 of file simd.h.

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

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

Friends And Related Function Documentation

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

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

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

Definition at line 8804 of file simd.h.

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

Definition at line 8812 of file simd.h.

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

Definition at line 8824 of file simd.h.

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

Definition at line 8772 of file simd.h.

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

Definition at line 8780 of file simd.h.

vfloat8 operator- ( const vfloat8 a)
friend

Definition at line 8784 of file simd.h.

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

Definition at line 8792 of file simd.h.

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

Definition at line 8800 of file simd.h.

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

Definition at line 8828 of file simd.h.

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

Definition at line 8836 of file simd.h.

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

Definition at line 8856 of file simd.h.

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

Stream output.

Definition at line 8418 of file simd.h.

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

Definition at line 8880 of file simd.h.

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

Definition at line 8840 of file simd.h.

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

Definition at line 8864 of file simd.h.

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

Definition at line 8872 of file simd.h.

Member Data Documentation

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

Definition at line 2649 of file simd.h.

simd_t simd::vfloat8::m_simd

Definition at line 2647 of file simd.h.

value_t simd::vfloat8::m_val[paddedelements]

Definition at line 2648 of file simd.h.


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