Vc 1.4.5
SIMD Vector Classes for C++
 
Loading...
Searching...
No Matches
Pre-defined Macros

The Vc library defines a few macros that you may rely on in your code:

Implementation Identification

One or more of the following macros will be defined:

  • Vc_IMPL_Scalar
  • Vc_IMPL_SSE
  • Vc_IMPL_SSE2
  • Vc_IMPL_SSE3
  • Vc_IMPL_SSSE3
  • Vc_IMPL_SSE4_1
  • Vc_IMPL_SSE4_2
  • Vc_IMPL_AVX
  • Vc_IMPL_AVX2

You can use these macros to enable target-specific implementations. In general, it is better to rely on function overloading or template mechanisms, though. Per default, code compiled against the Vc headers will use the instruction set that the compiler advertises as available. For example, compiling with "g++ -mssse3" chooses the SSE implementation (Vc::VectorAbi::Sse) with instructions from SSE, SSE2, SSE3 and SSSE3. After you include a Vc header, you will have the following macros available, which you can (but normally should not) use to determine the implementation Vc uses:

Vector/Mask Sizes

The macros Vc_DOUBLE_V_SIZE, Vc_FLOAT_V_SIZE, Vc_INT_V_SIZE, Vc_UINT_V_SIZE, Vc_SHORT_V_SIZE, and Vc_USHORT_V_SIZE make the default vector width accessible in the preprocessor. In most cases you should prefer the Vector::size() function, though. Since this function is constexpr you can use it for compile-time decisions (e.g. as template argument).

Compiler Identification (and related)

Version Macros

Boilerplate Code Generation