Vc
0.7.5-dev
SIMD Vector Classes for C++
|
|
Common interface to all Memory classes, independent of allocation on the stack or heap.
V | The vector type you want to operate on. (e.g. float_v or uint_v) |
Parent | This type is the complete type of the class that derives from MemoryBase. |
Dimension | The number of dimensions the implementation provides. |
RowMemory | Class to be used to work on a single row. |
#include <Vc/Memory>
Inherits MemoryDimensionBase< V, Parent, Dimension, RowMemory >.
Public Types | |
typedef V::EntryType | EntryType |
The type of the scalar entries in the array. |
Public Member Functions | |
size_t | entriesCount () const |
size_t | vectorsCount () const |
VectorPointerHelper< V, AlignedFlag > | vector (size_t i) |
const VectorPointerHelperConst < V, AlignedFlag > | vector (size_t i) const |
Const overload of the above function. | |
template<typename A > | |
VectorPointerHelper< V, A > | vectorAt (size_t i, A align=Vc::Aligned) |
template<typename A > | |
const VectorPointerHelperConst < V, A > | vectorAt (size_t i, A align=Vc::Aligned) const |
Const overload of the above function. | |
VectorPointerHelper< V, UnalignedFlag > | vector (size_t i, int shift) |
const VectorPointerHelperConst < V, UnalignedFlag > | vector (size_t i, int shift) const |
Const overload of the above function. | |
VectorPointerHelper< V, AlignedFlag > | firstVector () |
const VectorPointerHelperConst < V, AlignedFlag > | firstVector () const |
Const overload of the above function. | |
VectorPointerHelper< V, AlignedFlag > | lastVector () |
const VectorPointerHelperConst < V, AlignedFlag > | lastVector () const |
Const overload of the above function. |
size_t entriesCount | ( | ) | const |
Reimplemented in Memory< V, 0u, 0u >, Memory< V, Size, 0u >, and Memory< V, Size1, Size2 >.
size_t vectorsCount | ( | ) | const |
Reimplemented in Memory< V, 0u, 0u >, Memory< V, Size, 0u >, and Memory< V, Size1, Size2 >.
VectorPointerHelper<V, AlignedFlag> vector | ( | size_t | i | ) |
i | Selects the offset, where the vector should be read. |
i-th
vector in the memory.The return value can be used as any other vector object. I.e. you can substitute something like
with
This function ensures that only aligned loads and stores are used. Thus it only allows to access memory at fixed strides. If access to known offsets from the aligned vectors is needed the vector(size_t, int) function can be used.
const VectorPointerHelperConst<V, AlignedFlag> vector | ( | size_t | i | ) | const |
Const overload of the above function.
i | Selects the offset, where the vector should be read. |
i-th
vector in the memory. VectorPointerHelper<V, A> vectorAt | ( | size_t | i, |
A | align = Vc::Aligned |
||
) |
i-th
scalar entry in the memory.Example:
i | Specifies the scalar entry from where the vector will be loaded/stored. I.e. the values scalar(i), scalar(i + 1), ..., scalar(i + V::Size - 1) will be read/overwritten. |
align | You must take care to determine whether an unaligned load/store is required. Per default an aligned load/store is used. If i is not a multiple of V::Size you must pass Vc::Unaligned here. |
const VectorPointerHelperConst<V, A> vectorAt | ( | size_t | i, |
A | align = Vc::Aligned |
||
) | const |
Const overload of the above function.
i-th
scalar entry in the memory.i | Specifies the scalar entry from where the vector will be loaded/stored. I.e. the values scalar(i), scalar(i + 1), ..., scalar(i + V::Size - 1) will be read/overwritten. |
align | You must take care to determine whether an unaligned load/store is required. Per default an aligned load/store is used. If i is not a multiple of V::Size you must pass Vc::Unaligned here. |
VectorPointerHelper<V, UnalignedFlag> vector | ( | size_t | i, |
int | shift | ||
) |
i-th
vector + shift
in the memory.This function ensures that only unaligned loads and stores are used. It allows to access memory at any location aligned to the entry type.
i | Selects the memory location of the i-th vector. Thus if V::Size == 4 and i is set to 3 the base address for the load/store will be the 12th entry (same as &mem [12]). |
shift | Shifts the base address determined by parameter i by shift many entries. Thus vector(3, 1) for V::Size == 4 will load/store the 13th - 16th entries (same as &mem [13]). |
V::Size
will not result in aligned loads. You have to use the above vector(size_t) function for aligned loads instead.i
to 0 and use shift
as the parameter to select the memory address: VectorPointerHelper<V, AlignedFlag> firstVector | ( | ) |
This function is simply a shorthand for vector(0).
VectorPointerHelper<V, AlignedFlag> lastVector | ( | ) |
This function is simply a shorthand for vector(vectorsCount() - 1).