Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Static Public Member Functions | Static Public Attributes | List of all members
SimdBase< ScalarType, W > Struct Template Reference

Detailed Description

template<typename ScalarType, int W>
struct SimdBase< ScalarType, W >

Base class for vector types.

This is a thin wrapper base class which serves to make the vector width available to algorithms which avoid specifying the width as an additional template argument. Strictly speaking, this would only be required for compilers which don't understand C++11 constexpr.

Furthermore, there are a few general gather/scatter operations implemented here. These are often needed to transpose scalar arrays for SIMD processing. Although these are implemented in a very basic manner, inspection of the generated assembler shows that compilers turn this into appropriate sequences of extract/insert instructions where available.

See Also
float4, float8, double2, double4, EmulatedSimdType

#include <simdbase.h>

Static Public Member Functions

template<typename VectorType >
static void gather (int m, const Scalar x[], VectorType &xp)
 strided gather (x need not be aligned)
template<typename VectorType >
static void scatter (int m, const VectorType &xp, Scalar x[])
 strided scatter (x need not be aligned)
template<typename VectorType >
static void pack (int m, const Scalar x[], VectorType xp[])
 pack W*m values from x where they are stored with stride m
template<typename VectorType >
static void unpack (int m, const VectorType xp[], Scalar x[])
 store W*m values to x where they are stored with stride m

Static Public Attributes

static const int lanes = W
 the number of lanes, or vector width

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