Vc
1.3.2-dev
SIMD Vector Classes for C++
|
|
Automatic type vectorization.
The simdize<T> expression transforms the type T
to a vectorized variant. This requires the type T
to be a class template instance.
Example: First, we declare a class template for a three-dimensional point. The template parameter T
determines the type of the members and is float
in the scalar (classical) case.
In the following we create a type alias for the scalar type, which simply means instantiating PointTemplate
with float
. The resulting type can then be transformed with simdize.
The following shows a code example using the above Point
and PointV
types.
Classes | |
class | Iterator< T, N, M, V, Size, std::bidirectional_iterator_tag > |
This is the iterator type created when applying simdize to a bidirectional iterator type. More... | |
class | Iterator< T, N, M, V, Size, std::random_access_iterator_tag > |
This is the iterator type created when applying simdize to a random access iterator type. More... | |
Macros | |
#define | Vc_SIMDIZE_INTERFACE(MEMBERS_) |
Typedefs | |
template<typename T , size_t N = 0, typename MT = void> | |
using | simdize = SimdizeDetail::simdize< T, N, MT > |
Functions | |
template<typename S , typename T , size_t N> | |
void | assign (Adapter< S, T, N > &a, size_t i, const S &x) |
Assigns one scalar object x to a SIMD slot at offset i in the simdized object a . | |
template<typename S , typename T , size_t N> | |
S | extract (const Adapter< S, T, N > &a, size_t i) |
Extracts and returns one scalar object from a SIMD slot at offset i in the simdized object a . | |
template<typename S , typename T , size_t N> | |
Adapter< S, T, N > | shifted (const Adapter< S, T, N > &a, int shift) |
Returns a new vectorized object where each entry is shifted by shift . More... | |
template<typename S , typename T , std::size_t N> | |
void | swap (Adapter< S, T, N > &a, std::size_t i, S &x) |
Swaps one scalar object x with a SIMD slot at offset i in the simdized object a . | |
template<typename A > | |
void | swap (Scalar< A > &&a, typename A::scalar_type &b) |
std::swap interface to swapping one scalar object with a (virtual) reference to another object inside a vectorized object | |
template<typename A > | |
void | swap (typename A::scalar_type &b, Scalar< A > &&a) |
std::swap interface to swapping one scalar object with a (virtual) reference to another object inside a vectorized object | |
#define Vc_SIMDIZE_INTERFACE | ( | MEMBERS_ | ) |
Declares functions and constants for introspection by the simdize functions. This allows e.g. conversion between scalar T
and simdize<T>
.
MEMBERS_ | The data members of this struct/class listed inside extra parenthesis. The extra parenthesis are required because the macro would otherwise see a variable number of arguments. |
Example:
using simdize = SimdizeDetail::simdize<T, N, MT> |
Vectorize/Simdize the given type T.
T | This type must be a class template instance where the template arguments can be recursively replaced with their vectorized variant. If the type implements a specific interface for introspection and member modification, the resulting type can easily be constructed from objects of type T and scalar objects of type T can be extracted from it. |
N | This value determines the width of the vectorization. Per default it is set to 0 making the implementation choose the value considering the compilation target and the given type T. |
MT | This type determines the type to be used when replacing bool with Mask<MT>. If it is set to void the implementation choosed the type as smart as possible. |
|
inline |
Returns a new vectorized object where each entry is shifted by shift
.
This basically calls Vector<T>::shifted on every entry.
a | The object to apply the shift on. |
shift | The number of entries to shift by. |
a
shifted by shift
. Definition at line 1069 of file simdize.h.
Referenced by SimdArray< T, N, V, Wt >::shifted().