Vc
0.7.5-dev
SIMD Vector Classes for C++
|
|
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 > |
The main SIMD vector class. More... | |
class | float_v |
SIMD Vector of single precision floats. More... | |
class | double_v |
SIMD Vector of double precision floats. More... | |
class | int_v |
SIMD Vector of 32 bit signed integers. More... | |
class | uint_v |
SIMD Vector of 32 bit unsigned integers. More... | |
class | short_v |
SIMD Vector of 16 bit signed integers. More... | |
class | ushort_v |
SIMD Vector of 16 bit unsigned integers. More... | |
class | sfloat_v |
SIMD Vector of single precision floats that is guaranteed to have as many entries as a Vc::short_v and Vc::ushort_v. More... |
Enumerations | |
enum | PlatformConstants { VectorAlignment } |
Enum to declare platform specific constants. More... | |
enum | SpecialInitializer { Zero, One, IndexesFromZero } |
Enum to declare special initializers for vector constructors. More... | |
enum | LoadStoreFlags { Aligned, Unaligned, Streaming } |
Enum for load and store functions to select the optimizations that are safe to use. More... |
Functions | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &s, const Vc::Vector< T > &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) |
enum PlatformConstants |
enum SpecialInitializer |
Enum to declare special initializers for vector constructors.
enum LoadStoreFlags |
Enum for load and store functions to select the optimizations that are safe to use.
std::ostream& operator<< | ( | std::ostream & | s, |
const Vc::Vector< T > & | v | ||
) |
Prints the contents of a vector into a stream object.
will output (with SSE):
[0, 1, 2, 3]
s | Any standard C++ ostream object. For example std::cout or a std::stringstream object. |
v | Any Vc::Vector object. |
void Vc::deinterleave | ( | V * | a, |
V * | b, | ||
const M * | memory, | ||
A | align | ||
) |
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 | | ---------|-------|--------|--------|-------|------|----- sfloat_v | X | | X | X | | ---------|-------|--------|--------|-------|------|----- double_v | | X | | | | ---------|-------|--------|--------|-------|------|----- int_v | | | | X | | X ---------|-------|--------|--------|-------|------|----- uint_v | | | X | | X | ---------|-------|--------|--------|-------|------|----- short_v | | | | X | | ---------|-------|--------|--------|-------|------|----- ushort_v | | | X | | |