![]() |
Vc
1.3.0
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. |
Definition at line 361 of file memorybase.h.
#include <Vc/Memory>
Inherits MemoryDimensionBase< V, Parent, Dimension, RowMemory >.
Inherited by Memory< V, Size, 0u, InitPadding >.
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 |
template<typename Flags = AlignedTag> | |
MemoryVectorIterator< V, Flags > | begin (Flags flags=Flags()) |
Return a (vectorized) iterator to the start of this memory object. | |
template<typename Flags = AlignedTag> | |
MemoryVectorIterator< const V, Flags > | begin (Flags flags=Flags()) const |
const overload of the above | |
template<typename Flags = AlignedTag> | |
MemoryVectorIterator< V, Flags > | end (Flags flags=Flags()) |
Return a (vectorized) iterator to the end of this memory object. | |
template<typename Flags = AlignedTag> | |
MemoryVectorIterator< const V, Flags > | end (Flags flags=Flags()) const |
const overload of the above | |
template<typename Flags = AlignedTag> | |
std::enable_if<!std::is_convertible< Flags, int >::value, MemoryVector< V, Flags > >::type & | vector (size_t i, Flags=Flags()) |
template<typename Flags = AlignedTag> | |
std::enable_if<!std::is_convertible< Flags, int >::value, MemoryVector< const V, Flags > >::type & | vector (size_t i, Flags=Flags()) const |
Const overload of the above function. More... | |
template<typename Flags = UnalignedTag> | |
MemoryVector< V, Flags > & | vectorAt (size_t i, Flags flags=Flags()) |
template<typename Flags = UnalignedTag> | |
MemoryVector< const V, Flags > & | vectorAt (size_t i, Flags flags=Flags()) const |
Const overload of the above function. More... | |
template<typename ShiftT , typename Flags = decltype(Unaligned)> | |
std::enable_if< std::is_convertible< ShiftT, int >::value, MemoryVector< V, decltype(std::declval< Flags >)|Unaligned)> >::type & | vector (size_t i, ShiftT shift, Flags=Flags()) |
template<typename ShiftT , typename Flags = decltype(Unaligned)> | |
std::enable_if< std::is_convertible< ShiftT, int >::value, MemoryVector< const V, decltype(std::declval< Flags >)|Unaligned)> >::type & | vector (size_t i, ShiftT shift, Flags=Flags()) const |
Const overload of the above function. | |
template<typename Flags = AlignedTag> | |
MemoryVector< V, Flags > & | firstVector (Flags=Flags()) |
template<typename Flags = AlignedTag> | |
MemoryVector< const V, Flags > & | firstVector (Flags=Flags()) const |
Const overload of the above function. | |
template<typename Flags = AlignedTag> | |
MemoryVector< V, Flags > & | lastVector (Flags=Flags()) |
template<typename Flags = AlignedTag> | |
MemoryVector< const V, Flags > & | lastVector (Flags=Flags()) const |
Const overload of the above function. | |
void | setZero () |
Zero the whole memory area. | |
template<typename U > | |
Parent & | operator= (U &&x) |
Assign a value to all vectors in the array. | |
template<typename P2 , typename RM > | |
Parent & | operator+= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
(Inefficient) shorthand to add up two arrays. | |
template<typename P2 , typename RM > | |
Parent & | operator-= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
(Inefficient) shorthand to subtract two arrays. | |
template<typename P2 , typename RM > | |
Parent & | operator*= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
(Inefficient) shorthand to multiply two arrays. | |
template<typename P2 , typename RM > | |
Parent & | operator/= (const MemoryBase< V, P2, Dimension, RM > &rhs) |
(Inefficient) shorthand to divide two arrays. | |
Parent & | operator+= (EntryType rhs) |
(Inefficient) shorthand to add a value to an array. | |
Parent & | operator-= (EntryType rhs) |
(Inefficient) shorthand to subtract a value from an array. | |
Parent & | operator*= (EntryType rhs) |
(Inefficient) shorthand to multiply a value to an array. | |
Parent & | operator/= (EntryType rhs) |
(Inefficient) shorthand to divide an array with a value. | |
template<typename P2 , typename RM > | |
bool | operator== (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare equality of two arrays. | |
template<typename P2 , typename RM > | |
bool | operator!= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare two arrays. | |
template<typename P2 , typename RM > | |
bool | operator< (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare two arrays. | |
template<typename P2 , typename RM > | |
bool | operator<= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare two arrays. | |
template<typename P2 , typename RM > | |
bool | operator> (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare two arrays. | |
template<typename P2 , typename RM > | |
bool | operator>= (const MemoryBase< V, P2, Dimension, RM > &rhs) const |
(Inefficient) shorthand compare two arrays. | |
|
inline |
Definition at line 380 of file memorybase.h.
|
inline |
Definition at line 385 of file memorybase.h.
Referenced by MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator!=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator*=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator+=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator-=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator/=(), Memory< V, Size1, Size2, InitPadding >::operator=(), Memory< V, 0u, 0u, true >::operator=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator==(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator>(), and MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator>=().
|
inline |
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.
Definition at line 429 of file memorybase.h.
Referenced by MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator!=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator*=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator+=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator-=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator/=(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator==(), MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator>(), and MemoryBase< V, Memory< V, Size, 0u, InitPadding >, 1, void >::operator>=().
|
inline |
Const overload of the above function.
i | Selects the offset, where the vector should be read. |
i-th
vector in the memory. Definition at line 439 of file memorybase.h.
|
inline |
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. |
flags | You must take care to determine whether an unaligned load/store is required. Per default an unaligned load/store is used. If i is a multiple of V::Size you may want to pass Vc::Aligned here. |
Definition at line 463 of file memorybase.h.
|
inline |
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. |
flags | You must take care to determine whether an unaligned load/store is required. Per default an unaligned load/store is used. If i is a multiple of V::Size you may want to pass Vc::Aligned here. |
Definition at line 478 of file memorybase.h.
|
inline |
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: Definition at line 513 of file memorybase.h.
|
inline |
This function is simply a shorthand for vector(0).
Definition at line 535 of file memorybase.h.
|
inline |
This function is simply a shorthand for vector(vectorsCount() - 1).
Definition at line 550 of file memorybase.h.