Intel xvec
Experimental C++ simd class library
Loading...
Searching...
No Matches
xvec::simd::detail::vec_traits< _Vendor, _Tp, _Np > Struct Template Reference

#include <core.hpp>

Public Types

using element_type = element_storage_t<_Tp>
using element_container_type = container_for_type<_Tp>
using register_type = decltype(detail::get_register_type<builtin_type>())
 The register to use for intrinsic operations on this vec (e.g., for vec<double, 3> it would be __m256d). Note that unininitialised elements may be inserted to grow the vector to a size which can be represented in a register.

Static Public Member Functions

static constexpr register_type to_register (builtin_type v)
static constexpr builtin_type from_register (register_type r)
 A named constructor for creating a builtin type from a register value.

Static Public Attributes

static constexpr simd_size_type _numDataElements = complex_number<_Tp> ? 2 * _Np : _Np
 The number of underlying builtin data elements.
static constexpr simd_size_type _numStorageElements = isLlvm ? _numDataElements : std::bit_ceil((std::uint64_t)_numDataElements)
 The number of storage elements. This could be bigger than the number of data elements.

Detailed Description

template<typename _Vendor, typename _Tp, simd_size_type _Np>
struct xvec::simd::detail::vec_traits< _Vendor, _Tp, _Np >

Traits for standard builtin vector types.

Member Typedef Documentation

◆ element_type

template<typename _Vendor, typename _Tp, simd_size_type _Np>
using xvec::simd::detail::vec_traits< _Vendor, _Tp, _Np >::element_type = element_storage_t<_Tp>

The bare storage type used by the compiler for the elements. For arithmetic types this will typically be the same as the type itself, but for user-defined types or complex types it might be a container of raw bits instead.

Member Function Documentation

◆ from_register()

template<typename _Vendor, typename _Tp, simd_size_type _Np>
constexpr builtin_type xvec::simd::detail::vec_traits< _Vendor, _Tp, _Np >::from_register ( register_type r)
inlinestaticconstexpr

A named constructor for creating a builtin type from a register value.

Parameters
rThe register value from which to create the builtin value.
Returns
A builtin type containing the values from the register.

◆ to_register()

template<typename _Vendor, typename _Tp, simd_size_type _Np>
constexpr register_type xvec::simd::detail::vec_traits< _Vendor, _Tp, _Np >::to_register ( builtin_type v)
inlinestaticconstexpr

Convert the vector data into a native register value which can be passed directly into an intrinsic. Firstly the data is expanded to full a complete native register (e.g., 128-bit, 256-bit, etc) using uninitialised bits. Secondly, the register is converted into the most appropriate native register type which can be used directly by an intrinsic. For example, vec<int, 3> would become __m128i, vec<float, 5> would become __m256, and so on. This function must not be used on a vec which is too big to fit a native register (use simd::chunk to break it into register-sized pieces). Note that while many intrinsics accept a register which contains uninitialised data, this data might lead to incorrect operation. The caller is responsible for ensuring that the uninitialised bits are set to a safe value before calling an intrinsic which requires it.


The documentation for this struct was generated from the following file: