|
Intel xvec
Experimental C++ simd class library
|
Vector of elements sharing an element type and ABI. More...
#include <simd>
Public Types | |
| using | traits = detail::vec_traits<target_tag, _Tp, _Abi::num_elements> |
| Traits for this vec type. | |
| using | value_type = _Tp |
| The type of each individual element in the vec. | |
| using | reference_type = value_type& |
| A reference type for each individual element in the vec. | |
| using | abi_type = _Abi |
| The ABI type of this vec type. | |
| using | iterator = simd_iterator<basic_vec> |
| An iterator which allows a vec to be treated as a range. | |
| using | const_iterator = simd_iterator<const basic_vec> |
| using | real_type |
| The type used to represent a vec of the real-valued elements in a vec of complex values. | |
| using | builtin_type = typename traits::builtin_type |
| using | register_type = typename traits::register_type |
| For small vec objects this stores up to one target register's worth of data. | |
| using | mask_type = basic_mask<sizeof(_Tp), _Abi> |
Public Member Functions | |
| constexpr | basic_vec (const basic_vec &)=default |
| constexpr | basic_vec (basic_vec &&) noexcept=default |
| constexpr | basic_vec (const builtin_type &v) noexcept |
| constexpr | basic_vec (register_type r) noexcept |
| template<typename _InputSpan, typename... _Flags> requires (!vec_type<_InputSpan> && detail::span_extent_v<_InputSpan> == size && detail::explicitly_convertible_to<detail::span_element_type<_InputSpan>, _Tp>) | |
| constexpr | basic_vec (const _InputSpan &in_span, flags< _Flags... > f={}) |
| Constructs a basic_vec by reading the contents of an object with the same number of elements (e.g., span, C-array, std::array). | |
| template<typename _InputSpan, typename... _Flags> requires (!vec_type<_InputSpan> && detail::span_extent_v<_InputSpan> == size && detail::explicitly_convertible_to<detail::span_element_type<_InputSpan>, _Tp>) | |
| constexpr | basic_vec (const _InputSpan &in_span, const mask_type &m, flags< _Flags... > f={}) |
| Construct a vector from selected elements of a span-like object. | |
| template<detail::broadcast_constructible< _Tp > _Up = _Tp> | |
| constexpr | basic_vec (_Up &&v) noexcept |
| Create a basic_vec value in which every element is set to the single value provided. | |
| constexpr | basic_vec (const real_type &r, const real_type &i={}) noexcept |
| Construct a complex vector from real and imaginary component vectors. Each complex element combines the corresponding real and imaginary elements. If the imaginary vector is omitted, its elements are value initialized. | |
| template<vec_type _Vp> requires (!(vec_complex<basic_vec> ^ vec_complex<_Vp>) && (_Vp::size() == size()) && detail::explicitly_convertible_to<typename _Vp::value_type, _Tp> && detail::needs_explicit_conversion<typename _Vp::value_type, _Tp>) | |
| constexpr | basic_vec (const _Vp &v) noexcept |
| Explicitly convert a vector with the same number of elements. Both element types must be complex or neither must be complex. Construction of a complex vector from real components is provided separately. | |
| template<vec_type _Vp> requires (!(vec_complex<basic_vec> ^ vec_complex<_Vp>) && (_Vp::size() == size()) && detail::explicitly_convertible_to<typename _Vp::value_type, _Tp> && !detail::needs_explicit_conversion<typename _Vp::value_type, _Tp>) | |
| constexpr | basic_vec (const _Vp &v) noexcept |
| Convert a vector implicitly when its element conversion permits it. | |
| constexpr | basic_vec (detail::generator_invocable< value_type, size > auto &&fn) |
| Construct a vector by generating each element from its index. | |
| constexpr basic_vec & | operator= (const basic_vec &)=default |
| constexpr basic_vec & | operator= (basic_vec &&) noexcept=default |
| constexpr iterator | begin () noexcept |
| Return an iterator to the first element. | |
| constexpr const_iterator | begin () const noexcept |
| Return a const iterator to the first element. | |
| constexpr const_iterator | cbegin () const noexcept |
| Return a const iterator to the first element. | |
| constexpr std::default_sentinel_t | end () const noexcept |
| Return the end sentinel. | |
| constexpr std::default_sentinel_t | cend () const noexcept |
| Return the end sentinel. | |
| constexpr | operator typename traits::register_type () const |
| Allow the vec to be turned into the closest matching target vec register type. This will return the smallest target register that can contain all the elements of the vec. | |
| constexpr traits::register_type | to_register () const |
| constexpr builtin_type | to_builtin () const |
| Return the builtin value. | |
| constexpr value_type | operator[] (simd_size_type pos) const |
| Access the element at the specified position. | |
| constexpr auto | operator[] (const vec_integral auto &indexes) const |
| Select vector elements using an integral index vector. | |
| constexpr mask_type | operator! () const noexcept |
| Apply logical not to each vector element to produce a mask. | |
| constexpr basic_vec | operator~ () const noexcept |
| Apply bitwise not to each vector element. | |
| constexpr basic_vec | operator- () const noexcept |
| Negate each vector element. | |
| constexpr basic_vec | operator+ () const noexcept |
| Return a copy of the vector. | |
| constexpr basic_vec & | operator++ () noexcept |
| Increment each element and return the updated vector. | |
| constexpr basic_vec | operator++ (int) noexcept |
| Increment each element and return the original vector. | |
| constexpr basic_vec & | operator-- () noexcept |
| Decrement each element and return the updated vector. | |
| constexpr basic_vec | operator-- (int) noexcept |
| Decrement each element and return the original vector. | |
| constexpr real_type | real () const noexcept |
| Return the real components of the complex elements. | |
| constexpr void | real (const real_type &new_reals) noexcept |
| Replace the real component of each complex element. | |
| constexpr real_type | imag () const noexcept |
| Return the imaginary components of the complex elements. | |
| constexpr void | imag (const real_type &new_imags) noexcept |
| Replace the imaginary component of each complex element. | |
Static Public Member Functions | |
| static constexpr basic_vec | from_builtin (const builtin_type &v) noexcept |
| Construct a vector from its builtin representation. | |
Static Public Attributes | |
| static constexpr auto | size = size_constant<simd_size_v<_Tp, _Abi>>{} |
| Return the number of elements contained in the vec. | |
Friends | |
| constexpr basic_vec | simd_select_impl (const mask_type &m, const basic_vec &if_true, const basic_vec &if_false) noexcept |
| Implementation of element-wise vector selection. | |
| constexpr basic_vec | operator- (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Subtract corresponding elements. | |
| constexpr basic_vec | operator+ (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Add corresponding elements. | |
| constexpr basic_vec | operator* (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Multiply corresponding elements. | |
| constexpr basic_vec | operator* (const basic_vec &lhs, const detail::complex_element_type< _Tp > &rhs) noexcept |
| Multiply each complex element by a real scalar. | |
| constexpr basic_vec | operator* (const detail::complex_element_type< _Tp > &lhs, const basic_vec &rhs) noexcept |
| Multiply a real scalar by each complex element. | |
| constexpr basic_vec | operator/ (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Divide corresponding elements. | |
| constexpr basic_vec | operator% (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the remainder for corresponding elements. | |
| constexpr basic_vec | operator& (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the bitwise AND of corresponding elements. | |
| constexpr basic_vec | operator| (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the bitwise OR of corresponding elements. | |
| constexpr basic_vec | operator^ (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the bitwise XOR of corresponding elements. | |
| constexpr basic_vec & | operator*= (basic_vec &lhs, const detail::complex_element_type< _Tp > &rhs) noexcept |
| Multiply each complex element by a real scalar and assign the result. | |
| constexpr basic_vec & | operator*= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Multiply corresponding elements and assign the result. | |
| constexpr mask_type | operator== (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements for equality. | |
| constexpr mask_type | operator!= (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements for inequality. | |
| constexpr mask_type | operator< (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements using less-than. | |
| constexpr mask_type | operator<= (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements using less-than-or-equal. | |
| constexpr mask_type | operator> (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements using greater-than. | |
| constexpr mask_type | operator>= (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compare corresponding elements using greater-than-or-equal. | |
| constexpr basic_vec & | operator+= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Add corresponding elements and assign the result. | |
| constexpr basic_vec & | operator-= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Subtract corresponding elements and assign the result. | |
| constexpr basic_vec & | operator/= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Divide corresponding elements and assign the result. | |
| constexpr basic_vec & | operator%= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute element-wise remainders and assign the result. | |
| constexpr basic_vec & | operator&= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the element-wise bitwise AND and assign the result. | |
| constexpr basic_vec & | operator|= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the element-wise bitwise OR and assign the result. | |
| constexpr basic_vec & | operator^= (basic_vec &lhs, const basic_vec &rhs) noexcept |
| Compute the element-wise bitwise XOR and assign the result. | |
| constexpr basic_vec | operator<< (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Shift elements left by corresponding element-wise amounts. | |
| constexpr basic_vec | operator<< (const basic_vec &lhs, simd_size_type rhs) noexcept |
| Shift every element left by a shared amount. | |
| constexpr basic_vec | operator>> (const basic_vec &lhs, const basic_vec &rhs) noexcept |
| Shift elements right by corresponding element-wise amounts. | |
| constexpr basic_vec | operator>> (const basic_vec &lhs, simd_size_type rhs) noexcept |
| Shift every element right by a shared amount. | |
| constexpr basic_vec & | operator<<= (basic_vec &lhs, const basic_vec &shift) noexcept |
| Shift elements left by element-wise amounts and assign the result. | |
| constexpr basic_vec & | operator<<= (basic_vec &lhs, simd_size_type shift) noexcept |
| Shift every element left by a shared amount and assign the result. | |
| constexpr basic_vec & | operator>>= (basic_vec &lhs, const basic_vec &shift) noexcept |
| Shift elements right by element-wise amounts and assign the result. | |
| constexpr basic_vec & | operator>>= (basic_vec &lhs, simd_size_type shift) noexcept |
| Shift every element right by a shared amount and assign the result. | |
Vector of elements sharing an element type and ABI.
Additional element-type support is documented in Extended element types.
| using xvec::simd::basic_vec< _Tp, _Abi >::mask_type = basic_mask<sizeof(_Tp), _Abi> |
A mask which can be used to query elements (e.g., comparison, classification), and select/blend/merge elements.
| using xvec::simd::basic_vec< _Tp, _Abi >::real_type |
The type used to represent a vec of the real-valued elements in a vec of complex values.
|
inlineconstexprnoexcept |
Convert a vector implicitly when its element conversion permits it.
| v | The value to copy and convert. |