Vc  1.4.2
SIMD Vector Classes for C++
Vc Namespace Reference

Detailed Description

Vector Classes Namespace.

All functions and types of Vc are defined inside the Vc namespace.

Classes

struct  AlignedBase
 
class  Allocator
 An allocator that uses global new and supports over-aligned types, as per [C++11 20.6.9]. More...
 
struct  array
 
class  CpuId
 
struct  Exclusive
 Hint for Prefetch to select prefetches that mark the memory as exclusive. More...
 
struct  ImplementationT
 
class  Mask
 
struct  Prefetch
 
struct  Shared
 Hint for Prefetch to select prefetches that mark the memory as shared. More...
 
class  SimdArray
 Data-parallel arithmetic type with user-defined number of elements. More...
 
class  SimdMaskArray
 Data-parallel mask type with user-defined number of boolean elements. More...
 
class  Vector
 

Typedefs

using CurrentImplementation = ImplementationT< >
 
template<typename T , typename Allocator = std::allocator<T>>
using vector = Common::AdaptSubscriptOperator< std::vector< T, Allocator > >
 
using VectorAlignedBase = AlignedBase< Detail::max(alignof(Vector< float >), alignof(Vector< double >), alignof(Vector< ullong >), alignof(Vector< llong >), alignof(Vector< ulong >), alignof(Vector< long >), alignof(Vector< uint >), alignof(Vector< int >), alignof(Vector< ushort >), alignof(Vector< short >), alignof(Vector< uchar >), alignof(Vector< schar >))>
 
template<typename V >
using VectorAlignedBaseT = AlignedBase< alignof(V)>
 
using MemoryAlignedBase = AlignedBase< Detail::max(Vector< float >::MemoryAlignment, Vector< double >::MemoryAlignment, Vector< ullong >::MemoryAlignment, Vector< llong >::MemoryAlignment, Vector< ulong >::MemoryAlignment, Vector< long >::MemoryAlignment, Vector< uint >::MemoryAlignment, Vector< int >::MemoryAlignment, Vector< ushort >::MemoryAlignment, Vector< short >::MemoryAlignment, Vector< uchar >::MemoryAlignment, Vector< schar >::MemoryAlignment)>
 
template<typename V >
using MemoryAlignedBaseT = AlignedBase< V::MemoryAlignment >
 
typedef UnalignedTag DefaultLoadTag
 The default load tag type uses unaligned (non-streaming) loads.
 
typedef UnalignedTag DefaultStoreTag
 The default store tag type uses unaligned (non-streaming) stores.
 
template<typename T , size_t N = 0, typename MT = void>
using simdize = SimdizeDetail::simdize< T, N, MT >
 
template<typename T , ptrdiff_t Extent = dynamic_extent>
using span = Common::AdaptSubscriptOperator< Common::span< T, Extent > >
 
using llong = long long
 long long shorthand
 
using ullong = unsigned long long
 unsigned long long shorthand
 
using ulong = unsigned long
 unsigned long shorthand
 
using uint = unsigned int
 unsigned int shorthand
 
using ushort = unsigned short
 unsigned short shorthand
 
using uchar = unsigned char
 unsigned char shorthand
 
using schar = signed char
 signed char shorthand
 

Enumerations

enum  MallocAlignment { AlignOnVector, AlignOnCacheline, AlignOnPage }
 
enum  Implementation : std::uint_least32_t {
  ScalarImpl, SSE2Impl, SSE3Impl, SSSE3Impl,
  SSE41Impl, SSE42Impl, AVXImpl, AVX2Impl,
  MICImpl
}
 
enum  ExtraInstructions : std::uint_least32_t {
  Float16cInstructions = 0x01000, Fma4Instructions = 0x02000, XopInstructions = 0x04000, PopcntInstructions = 0x08000,
  Sse4aInstructions = 0x10000, FmaInstructions = 0x20000, VexInstructions = 0x40000, Bmi2Instructions = 0x80000
}
 

Functions

const char * versionString ()
 
constexpr unsigned int versionNumber ()
 
template<typename T , typename Abi >
std::ostream & operator<< (std::ostream &out, const Vc::Vector< T, Abi > &v)
 
template<typename T , typename Abi >
std::ostream & operator<< (std::ostream &out, const Vc::Mask< T, Abi > &m)
 
template<class InputIt , class UnaryFunction >
UnaryFunction simd_for_each (InputIt first, InputIt last, UnaryFunction f)
 
template<typename V , typename M , typename A >
void deinterleave (V *a, V *b, const M *memory, A align)
 
template<typename Mask , typename T >
enable_if< is_simd_mask< Mask >::value &&is_simd_vector< T >::value, T > iif (const Mask &condition, const T &trueValue, const T &falseValue)
 
template<typename Mask , typename T >
enable_if< is_simd_mask< Mask >::value &&!is_simd_vector< T >::value, T > iif (const Mask &, const T &, const T &)=delete
 
template<typename T >
constexpr T iif (bool condition, const T &trueValue, const T &falseValue)
 
template<typename V , typename = enable_if<Traits::is_simd_vector<V>::value>>
std::pair< V, V > interleave (const V &a, const V &b)
 
template<typename V , typename S >
Common::InterleavedMemoryWrapper< S, V > make_interleave_wrapper (S *s)
 Creates an adapter around a given array of structure (AoS) that enables optimized loads. More...
 
template<typename Container , typename T >
constexpr auto makeContainer (std::initializer_list< T > list) -> decltype(make_container_helper< Container, T >::help(list))
 
template<typename T , Vc::MallocAlignment A>
T * malloc (size_t n)
 Allocates memory on the Heap with alignment and padding suitable for vectorized access. More...
 
template<typename T >
void free (T *p)
 Frees memory that was allocated with Vc::malloc. More...
 
template<typename To , typename From >
To simd_cast (From &&x, enable_if< std::is_same< To, Traits::decay< From >>::value >=nullarg)
 Casts the argument x from type From to type To. More...
 
template<typename To >
To simd_cast ()
 A cast from nothing results in default-initialization of To. More...
 
template<typename S , typename T , size_t N>
void assign (SimdizeDetail::Adapter< S, T, N > &a, size_t i, const S &x)
 Assigns one scalar object x to a SIMD slot at offset i in the simdized object a.
 
template<typename S , typename T , size_t N>
extract (const SimdizeDetail::Adapter< S, T, N > &a, size_t i)
 Extracts and returns one scalar object from a SIMD slot at offset i in the simdized object a.
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > > sin (const Vector< T, Abi > &x)
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > > cos (const Vector< T, Abi > &x)
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > > asin (const Vector< T, Abi > &x)
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > > atan (const Vector< T, Abi > &x)
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > > atan2 (const Vector< T, Abi > &y, const Vector< T, Abi > &x)
 
template<typename T , typename Abi >
void sincos (const Vector< T, Abi > &x, Vector< T, detail::not_fixed_size_abi< Abi >> *sin, Vector< T, Abi > *cos)
 
template<typename T , typename Abi , typename = enable_if<std::is_floating_point<T>::value && !detail::is_fixed_size_abi<Abi>::value>>
Vector< T, Abi > copysign (Vector< T, Abi > magnitude, Vector< T, Abi > sign)
 
template<typename T , typename Abi , typename = enable_if<std::is_floating_point<T>::value && !detail::is_fixed_size_abi<Abi>::value>>
Vector< T, Abi > exponent (Vector< T, Abi > x)
 
template<typename T , typename Abi >
Vector< T, detail::not_fixed_size_abi< Abi > >::MaskType isnegative (Vector< T, Abi > x)
 
template<typename V , typename T , typename Abi >
enable_if<(V::size()==Vector< T, Abi >::size() &&sizeof(typename V::VectorEntryType)==sizeof(typename Vector< T, Abi >::VectorEntryType) &&sizeof(V)==sizeof(Vector< T, Abi >) &&alignof(V)<=alignof(Vector< T, Abi >)), V > reinterpret_components_cast (const Vector< T, Abi > &x)
 
template<typename M >
constexpr WhereImpl::WhereMask< M > where (const M &mask)
 

Variables

constexpr std::size_t VectorAlignment = alignof(VectorAlignedBase)
 
constexpr std::size_t MemoryAlignment = alignof(MemoryAlignedBase)
 
constexpr AlignedTag Aligned
 Use this object for a flags parameter to request aligned loads and stores. More...
 
constexpr UnalignedTag Unaligned
 Use this object for a flags parameter to request unaligned loads and stores. More...
 
constexpr StreamingTag Streaming
 Use this object for a flags parameter to request streaming loads and stores. More...
 
constexpr LoadStoreFlags::LoadStoreFlags< PrefetchFlag<> > PrefetchDefault
 Use this object for a flags parameter to request default software prefetches to be emitted.
 
constexpr VectorSpecialInitializerZero Zero = {}
 The special object Vc::Zero can be used to construct Vector and Mask objects initialized to zero/false.
 
constexpr VectorSpecialInitializerOne One = {}
 The special object Vc::One can be used to construct Vector and Mask objects initialized to one/true.
 
constexpr VectorSpecialInitializerIndexesFromZero IndexesFromZero = {}
 The special object Vc::IndexesFromZero can be used to construct Vector objects initialized to values 0, 1, 2, 3, 4, ...
 

Function Documentation

◆ make_interleave_wrapper()

Common::InterleavedMemoryWrapper<S, V> Vc::make_interleave_wrapper ( S *  s)
inline

Creates an adapter around a given array of structure (AoS) that enables optimized loads.

  • deinterleaving operations / interleaving operations + stores for vector access (using V).
Template Parameters
VThe Vc::Vector<T> type to use per element of the structure.
Parameters
sA pointer to an array of structures containing data members of type T.
See also
Vc::Common::InterleavedMemoryWrapper

Definition at line 345 of file interleavedmemory.h.

Referenced by make_interleave_wrapper().

◆ simd_cast() [1/2]

To Vc::simd_cast ( From &&  x,
enable_if< std::is_same< To, Traits::decay< From >>::value >  = nullarg 
)
inline

Casts the argument x from type From to type To.

This function implements the trivial case where To and From are the same type.

Parameters
xThe object of type From to be converted to type To.
Returns
An object of type To with all vector components converted according to standard conversion behavior as mandated by the C++ standard for the underlying arithmetic types.

Definition at line 52 of file simd_cast.h.

◆ simd_cast() [2/2]

To Vc::simd_cast ( )
inline

A cast from nothing results in default-initialization of To.

This function can be useful in generic code where a parameter pack expands to nothing.

Returns
A zero-initialized object of type To.

Definition at line 64 of file simd_cast.h.