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
 
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...
 
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)
 
vfloat4 lo () const
 Extract the lower percision vfloat4. More...
 
vfloat4 hi () const
 Extract the higher percision 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 bool_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 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 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]
 
   simd_raw_t< float, 4 >::type   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, 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 2384 of file simd.h.

Member Typedef Documentation

Definition at line 2396 of file simd.h.

Definition at line 2395 of file simd.h.

the native SIMD type used

Definition at line 2391 of file simd.h.

typedef float simd::vfloat8::value_t

Underlying equivalent scalar value type.

Definition at line 2387 of file simd.h.

SIMD bool type.

Definition at line 2394 of file simd.h.

SIMD int type.

Definition at line 2392 of file simd.h.

SIMD int type.

Definition at line 2393 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2388 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2389 of file simd.h.

anonymous enum
Enumerator
bits 

Definition at line 2390 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat8::vfloat8 ( )
inline

Default constructor (contents undefined)

Definition at line 2399 of file simd.h.

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

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

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

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

Construct from a pointer to 8 values.

Definition at line 2409 of file simd.h.

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

Copy construct from another vfloat8.

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

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

Construct from two vfloat4's.

Definition at line 8116 of file simd.h.

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

Construct from the underlying SIMD type.

Definition at line 2421 of file simd.h.

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

Construct from a pointer to unsigned short values.

Definition at line 2432 of file simd.h.

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

Construct from a pointer to short values.

Definition at line 2435 of file simd.h.

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

Construct from a pointer to unsigned char values.

Definition at line 2438 of file simd.h.

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

Construct from a pointer to char values.

Definition at line 2441 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE void simd::vfloat8::clear ( )

Set all components to 0.0.

Definition at line 8156 of file simd.h.

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

Return a pointer to the underlying scalar type.

Definition at line 2428 of file simd.h.

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

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

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

Definition at line 8387 of file simd.h.

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

Extract the higher percision vfloat4.

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

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

Extract the lower percision vfloat4.

Definition at line 8099 of file simd.h.

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

Helper: load a single value into all components.

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

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

Load from an array of values.

Definition at line 8191 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 8203 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 8233 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 8243 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 8253 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 8262 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 8330 of file simd.h.

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

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

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

Return the raw SIMD type.

Definition at line 2424 of file simd.h.

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

Assign a single value to all components.

Definition at line 2449 of file simd.h.

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

Assign a vfloat8.

Definition at line 2452 of file simd.h.

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

Component access (get)

Definition at line 8085 of file simd.h.

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

Component access (set)

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

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

Definition at line 8409 of file simd.h.

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

Definition at line 8589 of file simd.h.

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

Definition at line 8586 of file simd.h.

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

Definition at line 8587 of file simd.h.

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

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

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

Definition at line 8286 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 8298 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 8352 of file simd.h.

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

Definition at line 8363 of file simd.h.

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

Definition at line 2386 of file simd.h.

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

Definition at line 8585 of file simd.h.

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

Definition at line 8582 of file simd.h.

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

Definition at line 8583 of file simd.h.

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

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

Friends And Related Function Documentation

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

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

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

Definition at line 8461 of file simd.h.

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

Definition at line 8421 of file simd.h.

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

Definition at line 8429 of file simd.h.

vfloat8 operator- ( const vfloat8 a)
friend

Definition at line 8433 of file simd.h.

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

Definition at line 8441 of file simd.h.

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

Definition at line 8449 of file simd.h.

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

Definition at line 8465 of file simd.h.

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

Definition at line 8473 of file simd.h.

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

Definition at line 8493 of file simd.h.

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

Stream output.

Definition at line 8091 of file simd.h.

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

Definition at line 8517 of file simd.h.

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

Definition at line 8477 of file simd.h.

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

Definition at line 8501 of file simd.h.

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

Definition at line 8509 of file simd.h.

Member Data Documentation

union { ... }
simd_raw_t<float,4>::type simd::vfloat8::m_4[2]

Definition at line 2591 of file simd.h.

simd_t simd::vfloat8::m_simd

Definition at line 2589 of file simd.h.

value_t simd::vfloat8::m_val[paddedelements]

Definition at line 2590 of file simd.h.


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