The vector classes abstract the SIMD registers and their according instructions into types that feel very familiar to C++ developers.
Note that the documented types Vc::float_v, Vc::double_v, Vc::int_v, Vc::uint_v, Vc::short_v, and Vc::ushort_v are actually typedefs
of the Vc::Vector<T>
class:
Generally you can always mix scalar values with vectors as Vc will automatically broadcast the scalar to a vector and then execute a vector operation. But, in order to ensure that implicit type conversions only happen as defined by the C standard, there is only a very strict implicit scalar to vector constructor:
The following ways of initializing a vector are not allowed:
Instead, if really necessary you can do:
Classes | |
class | Vector< T, Abi > |
The main vector class for expressing data parallelism. More... | |
Functions | |
template<typename T , typename Abi > | |
std::ostream & | operator<< (std::ostream &out, const Vc::Vector< T, Abi > &v) |
Prints the contents of a vector into a stream object. | |
template<typename V , typename M , typename A > | |
void | deinterleave (V *a, V *b, const M *memory, A align) |
Variables | |
constexpr std::size_t | VectorAlignment = alignof(VectorAlignedBase) |
Specifies the most conservative memory alignment necessary for Vector<T> objects with default VectorAbi. | |
constexpr std::size_t | MemoryAlignment = alignof(MemoryAlignedBase) |
Specifies the most conservative memory alignment necessary for aligned loads and stores of Vector types. | |
Vector Type Aliases | |
using | double_v = Vector<double> |
vector of double precision | |
using | float_v = Vector<float> |
vector of single precision | |
using | int_v = Vector<int> |
vector of signed integers | |
using | uint_v = Vector<uint> |
vector of unsigned integers | |
using | short_v = Vector<short> |
vector of signed short integers | |
using | ushort_v = Vector<ushort> |
vector of unsigned short integers | |
|
inline |
Prints the contents of a vector into a stream object.
will output (with SSE):
[0, 1, 2, 3]
out | Any standard C++ ostream object. For example std::cout or a std::stringstream object. |
v | Any Vc::Vector object. |
|
inline |
Loads two vectors of values from an interleaved array.
a,b | The vectors to load the values from memory into. |
memory | The memory location where to read the next 2 * V::Size values from |
align | Either pass Vc::Aligned or Vc::Unaligned. It defaults to Vc::Aligned if nothing is specified. |
If you store your data as
then the deinterleave function allows you to read Size
concurrent x and y values like this:
This code will load m[10], m[12], m[14], ... into x
and m[11], m[13], m[15], ... into y
.
The deinterleave function supports the following type combinations:
V \ M | float | double | ushort | short | uint | int =========|=======|========|========|=======|======|===== float_v | X | | X | X | | ---------|-------|--------|--------|-------|------|----- double_v | | X | | | | ---------|-------|--------|--------|-------|------|----- int_v | | | | X | | X ---------|-------|--------|--------|-------|------|----- uint_v | | | X | | X | ---------|-------|--------|--------|-------|------|----- short_v | | | | X | | ---------|-------|--------|--------|-------|------|----- ushort_v | | | X | | |
Definition at line 76 of file deinterleave.h.
Referenced by Vc::deinterleave().
|
constexpr |
Specifies the most conservative memory alignment necessary for Vector<T> objects with default VectorAbi.
Use this value e.g. with an alignas
expression or when allocating aligned memory dynamically (Vc::malloc).
|
constexpr |
Specifies the most conservative memory alignment necessary for aligned loads and stores of Vector types.
Use this value e.g. with an alignas
expression or when allocating aligned memory dynamically (Vc::malloc).
Definition at line 215 of file vector.h.
Referenced by SimdArray< T, N, V, Wt >::reversed(), and SimdArray< T, N, V, Wt >::rotated().