Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

simd.h File Reference

SIMD-type algorithms, with hardware acceleration, if available. More...

#include "ualgo.h"
#include "ulimits.h"

Namespaces

namespace  ustl
namespace  ustl::simd

Classes

struct  ustl::simd::fpadds< T >
struct  ustl::simd::fpsubs< T >
struct  ustl::simd::fpshl< T >
struct  ustl::simd::fpshr< T >
struct  ustl::simd::fpmin< T >
struct  ustl::simd::fpmax< T >
struct  ustl::simd::fpavg< T >
struct  ustl::simd::fcast< T, D >

Defines

#define SIMD_PACKEDOP1(name, operation)
#define SIMD_PACKEDOP2(name, operation)
#define SIMD_PACKEDOP3(name, operation)
#define SIMD_SINGLEOP1(name, operation)
#define SIMD_CONVERTOP(name, operation)
#define VECTOR_ATTRIBUTE(x)
#define SIMD_PKOP2_SPEC(n, type, optype)
#define SIMD_PASSIGN_SPEC(n, type)
#define SIMD_IPASSIGN_SPEC(n, type)
#define SIMD_CONVERT_SPEC(n, type1, type2, optype)

Typedefs

typedef uint8_t v8qi_t VECTOR_ATTRIBUTE (V8QI)

Functions

template<typename Ctr, typename UnaryOperation>
void packop (Ctr &op1, UnaryOperation op)
 Applies op to each element in op1.
template<typename Ctr, typename BinaryOperation>
void packop (const Ctr &op1, Ctr &op2, BinaryOperation op)
 Applies op to each element in op1 and op2 and stores in op2.
template<typename Ctr, typename BinaryOperation>
void packop (const Ctr &op1, const Ctr &op2, Ctr &result, BinaryOperation op)
 Applies op to corresponding elements in op1 and op2 and stores in result.
template<typename Ctr>
void passign (const Ctr &op1, Ctr &result)
 Copies op1 into result.
template<typename Ctr>
void ipassign (typename Ctr::const_iterator op1, Ctr &result)
 Copies result.size() elements from op1 to result.
template<typename Ctr1, typename Ctr2, typename ConvertFunction>
void pconvert (const Ctr1 &op1, Ctr2 &op2, ConvertFunction f)


Detailed Description

SIMD-type algorithms, with hardware acceleration, if available.

All algorithms are container-based because iterator syntax is just too damn verbose and because the specializations need to be able to tell how many elements are in the container in order to choose proper SIMD instruction set (i.e.: 4 floats select SSE, while 2 floats select 3dNow!) Specializations are only for the tuple template because the container must be of a fixed and compile-time-known size for the compiler to be able to choose the specialization.


Define Documentation

#define SIMD_CONVERT_SPEC n,
type1,
type2,
optype   ) 
 

Value:

template <>                                     \
inline void pconvert (const tuple<n,type1>& oin, tuple<n,type2>& oout, optype<type1,type2>)

#define SIMD_CONVERTOP name,
operation   ) 
 

Value:

template <typename Ctr1, typename Ctr2>         \
inline void name (const Ctr1& op1, Ctr2& op2)   \
{                                               \
    typedef typename Ctr1::value_type value1_t; \
    typedef typename Ctr2::value_type value2_t; \
    pconvert (op1, op2, operation<value1_t, value2_t>());\
}

#define SIMD_IPASSIGN_SPEC n,
type   ) 
 

Value:

template <>                                     \
inline void ipassign (tuple<n,type>::const_iterator oin, tuple<n,type>& oout)

#define SIMD_PACKEDOP1 name,
operation   ) 
 

Value:

template <typename Ctr>                         \
inline void name (Ctr& op1)                     \
{                                               \
    typedef typename Ctr::value_type value_t;   \
    packop (op1, operation<value_t>());         \
}

#define SIMD_PACKEDOP2 name,
operation   ) 
 

Value:

template <typename Ctr>                         \
inline void name (const Ctr& op1, Ctr& op2)     \
{                                               \
    typedef typename Ctr::value_type value_t;   \
    packop (op1, op2, operation<value_t>());    \
}

#define SIMD_PACKEDOP3 name,
operation   ) 
 

Value:

template <typename Ctr>                                 \
inline void name (const Ctr& op1, const Ctr& op2, Ctr& result)  \
{                                                       \
    typedef typename Ctr::value_type value_t;           \
    packop (op1, op2, result, operation<value_t>());    \
}

#define SIMD_PASSIGN_SPEC n,
type   ) 
 

Value:

template <>                                     \
inline void passign (const tuple<n,type>& oin, tuple<n,type>& oout)

#define SIMD_PKOP2_SPEC n,
type,
optype   ) 
 

Value:

template <>                                     \
inline void packop (const tuple<n,type>& oin, tuple<n,type>& oout, optype<type>)

#define SIMD_SINGLEOP1 name,
operation   ) 
 

Value:

template <typename T>                           \
inline T name (T op)                            \
{                                               \
    operation<T> obj;                           \
    return (obj(op));                           \
}


Generated on Mon Jan 17 14:35:02 2005 for uSTL by 1.3.9 Doxygen Hosted on SourceForge.net