E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches
eve::wide< Type, Cardinal > Struct Template Reference

Wrapper for SIMD registers. More...

#include <eve/arch/cpu/wide.hpp>

Detailed Description

template<arithmetic_scalar_value Type, typename Cardinal>
struct eve::wide< Type, Cardinal >

Required header: #include <eve/wide.hpp>

eve::wide is an architecture-agnostic representation of a SIMD register and provides standardized API to access informations, compute values and manipulate such register.

Template Parameters
TypeType of value to store in the register
CardinalCardinal of the register. By default, the best cardinal for current architecture is selected.

Public Types

using value_type = Type
 The type stored in the register.
 
using abi_type = abi_t< Type, Cardinal >
 The ABI tag for this register.
 
using storage_type = typename storage_base::storage_type
 The type used for this register storage.
 
using cardinal_type = Cardinal
 Type describing the number of lanes of current wide.
 
using size_type = std::ptrdiff_t
 Type representing the size of the current wide.
 
using is_like = value_type
 Opt-in for like concept.
 
template<typename T , typename N = expected_cardinal_t<T>>
using rebind = wide< T, N >
 Generates a eve::wide from a different type T and cardinal N. If unspecified, N is computed as expected_cardinal_t<T>.
 
template<typename N >
using rescale = wide< Type, N >
 Generates a eve::wide type from a different cardinal N.
 

Public Member Functions

Constructors
 wide ()
 Default constructor This operation is a no-op unless Type satisfies eve::product_type and has a non trivial default constructor.
 
 wide ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 wide (storage_type const &r) noexcept
 Constructs from ABI-specific storage.
 
template<std::input_iterator It>
 wide (It b, It e) noexcept
 Constructs a eve::wide from a pair of Input Iterator. Construction is done piecewise unless the Input Iterators are [Random Access Iterators](https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator.
 
template<detail::range Range>
requires (!std::same_as<storage_type, std::remove_reference_t<Range>>)
 wide (Range &&r) noexcept
 Constructs a eve::wide from a Container. Construction is done piecewise unless the Input Iterators extracted from r are [Random Access Iterators](https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator.
 
template<simd_compatible_ptr< wide > Ptr>
 wide (Ptr ptr) noexcept
 Constructs a eve::wide from a SIMD compatible pointer.
 
template<detail::data_source... Ptr>
requires (kumi::product_type<Type>)
 wide (eve::soa_ptr< Ptr... > ptr) noexcept
 Constructs a eve::wide from a SIMD compatible pointer.
 
template<typename S >
requires std::constructible_from<Type,S>
 wide (S const &v) noexcept
 Constructs a eve::wide by splatting a scalar value in all lanes.
 
template<scalar_value S0, scalar_value S1, scalar_value... Ss>
requires ( (Cardinal::value == 2 + sizeof...(vs)) && std::is_convertible_v<S0,Type> && (std::is_convertible_v<S1, Type> && ... && std::is_convertible_v<Ss, Type>) )
 wide (S0 v0, S1 v1, Ss... vs) noexcept
 Constructs a eve::wide from a sequence of scalar values of proper size.
 
template<typename S0 , typename... Ss>
requires (kumi::sized_product_type_or_more<Type,1+sizeof...(Ss)>)
 wide (S0 const &v0, Ss const &...vs) noexcept
 Constructs a eve::wide from a sequence of values.
 
template<eve::invocable< size_type, size_type > Generator>
 wide (Generator &&g) noexcept
 Constructs a eve::wide from a Callable Object.
 
template<typename Half >
requires (Cardinal::value == 2 * Half::value)
 wide (wide< Type, Half > const &l, wide< Type, Half > const &h) noexcept
 Constructs a eve::wide by combining two eve::wide of half the current cardinal. Does not participate in overload resolution if Cardinal::value != 2 * Half::value.
 
Assignment operators
wideoperator= (storage_type const &r)
 Assignment of an architecture-specific SIMD register.
 
template<scalar_value S>
wideoperator= (S v) noexcept
 Assignment of a scalar value by splatting it in all lanes.
 
Modifiers
void set (std::size_t i, scalar_value auto v) noexcept
 Set the value of a given lane.
 
auto get (std::size_t i) const noexcept
 Retrieve the value from a given lane.
 
auto back () const noexcept
 Retrieve the value of the first lanes.
 
auto front () const noexcept
 Retrieve the value of the first lane.
 
auto slice () const
 Slice a eve::wide into two eve::wide of half cardinal. Does not participate in overload resolution if Cardinal::value == 1.
 
template<std::size_t Slice>
requires (Cardinal::value > 1)
auto slice (slice_t< Slice > s) const
 Return the upper or lower half-sized slice of a eve::wide. Does not participate in overload resolution if Cardinal::value == 1.
 
void swap (wide &other)
 Exchange this value with another eve::wide.
 
wideoperator++ () noexcept
 Pre-incrementation operator.
 
wideoperator-- () noexcept
 Pre-decrementation operator.
 
wide operator++ (int) noexcept
 Post-incrementation operator.
 
wide operator-- (int) noexcept
 Post-decrementation operator.
 

Static Public Member Functions

Indexing and reordering
static constexpr size_type size () noexcept
 Size of the wide in number of lanes.
 
static constexpr size_type max_size () noexcept
 Maximal number of lanes for a given wide.
 
static constexpr bool empty () noexcept
 Check if a wide contains 0 lanes.
 

Friends

void swap (wide &lhs, wide &rhs) noexcept
 Swaps the contents of lhs and rhs by calling lhs.swap(rhs).
 
auto operator~ (wide const &v) noexcept
 Perform a bitwise complement on all the wide lanes.
 
template<value V>
auto operator&= (wide &w, V o) noexcept
 
template<scalar_value U, typename M >
auto operator& (wide const &v, wide< U, M > const &w) noexcept
 Perform a bitwise and between all lanes of two wide instances. Do not participate to overload resolution if both wide doesn't has the same sizeof
 
template<scalar_value S>
auto operator& (wide const &v, S w) noexcept
 Perform a bitwise and between all lanes of a eve::wide and a scalar Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
template<scalar_value S>
auto operator& (S v, wide const &w) noexcept
 Perform a bitwise and between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
template<value V>
auto operator|= (wide &w, V o) noexcept
 
template<scalar_value U, typename M >
auto operator| (wide const &v, wide< U, M > const &w) noexcept
 Perform a bitwise or between all lanes of two wide instances. Do not participate to overload resolution if both wide doesn't has the same sizeof
 
template<scalar_value S>
auto operator| (wide const &v, S w) noexcept
 Perform a bitwise or between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
template<scalar_value S>
auto operator| (S v, wide const &w) noexcept
 Perform a bitwise or between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
template<value V>
auto operator^= (wide &w, V o) noexcept
 Perform a bitwise xor on all the wide lanes and assign the result to the current one.
 
template<scalar_value U, typename M >
auto operator^ (wide const &v, wide< U, M > const &w) noexcept
 Perform a bitwise xor between all lanes of two wide instances. Do not participate to overload resolution if both wide doesn't has the same sizeof
 
template<scalar_value S>
auto operator^ (wide const &v, S w) noexcept
 Perform a bitwise xor between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
template<scalar_value S>
auto operator^ (S v, wide const &w) noexcept
 Perform a bitwise xor between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
auto operator+ (wide const &v) noexcept
 Unary plus operator.
 
auto operator- (wide const &v) noexcept
 Unary minus operator. See also: eve::unary_minus.
 
template<value V>
auto operator+= (wide &w, V v) noexcept -> decltype(detail::self_add(w, v)) requires(!kumi::product_type< Type >)
 Perform the compound addition on all the wide lanes and assign the result to the current one. See also: eve::add.
 
auto operator+ (wide const &v, wide const &w) noexcept
 Perform the addition between all lanes of its parameters See also: eve::add.
 
auto operator+ (plain_scalar_value auto s, wide const &v) noexcept
 Perform the addition between a scalar and all lanes of a eve::wide See also: eve::add.
 
auto operator+ (wide const &v, plain_scalar_value auto s) noexcept
 Perform the addition between all lanes of a eve::wide and a scalar See also: eve::add.
 
template<value V>
auto operator-= (wide &w, V v) noexcept -> decltype(detail::self_sub(w, v)) requires(!kumi::product_type< Type >)
 Perform the compound difference on all the wide lanes and assign the result to the current one. See also: eve::sub.
 
auto operator- (wide const &v, wide const &w) noexcept
 Perform the difference between all lanes of its parameters See also: eve::sub.
 
auto operator- (plain_scalar_value auto s, wide const &v) noexcept
 Perform the difference between a scalar and all lanes of a eve::wide See also: eve::sub.
 
auto operator- (wide const &v, plain_scalar_value auto s) noexcept
 Perform the difference between all lanes of a eve::wide and a scalar See also: eve::sub.
 
template<value V>
auto operator*= (wide &w, V o) noexcept -> decltype(detail::self_mul(w, o)) requires(!kumi::product_type< Type >)
 Perform the compound product on all the wide lanes and assign the result to the current one. See also: eve::mul.
 
auto operator* (wide const &v, wide const &w) noexcept
 Perform the product between all lanes of its parameters See also: eve::mul.
 
auto operator* (plain_scalar_value auto s, wide const &v) noexcept
 Perform the product between a scalar and all lanes of a eve::wide See also: eve::mul.
 
auto operator* (wide const &v, plain_scalar_value auto s) noexcept
 Perform the product between all lanes of a eve::wide and a scalar See also: eve::mul.
 
template<value V>
auto operator/= (wide &w, V o) noexcept -> decltype(detail::self_div(w, o)) requires(!kumi::product_type< Type >)
 Perform the compound division on all the wide lanes and assign the result to the current one. See also: eve::div.
 
auto operator/ (wide const &v, wide const &w) noexcept
 Perform the division between all lanes of its parameters See also: eve::div.
 
auto operator/ (plain_scalar_value auto s, wide const &v) noexcept
 Perform the division between a scalar and all lanes of a eve::wide See also: eve::div.
 
auto operator/ (wide const &v, plain_scalar_value auto s) noexcept
 Perform the division between all lanes of a eve::wide and a scalar See also: eve::div.
 
template<integral_value V>
auto & operator%= (wide &w, V o) noexcept
 Perform the compound modulo on all the wide lanes and assign the result to the current one. Does not participate in overload resolution if Type does not models integral_scalar_value.
 
auto operator% (wide const &v, wide const &w) noexcept
 Perform the modulo between all lanes of its parameters. Does not participate in overload resolution if Type does not models integral_scalar_value.
 
template<integral_scalar_value S>
auto operator% (S s, wide const &v) noexcept
 Perform the modulo between a scalar and all lanes of a eve::wide Does not participate in overload resolution if Type does not models integral_scalar_value.
 
auto operator% (wide const &v, integral_scalar_value auto s) noexcept
 Perform the modulo between all lanes of a eve::wide and a scalar Does not participate in overload resolution if Type does not models integral_scalar_value.
 
template<integral_value S>
auto & operator<<= (wide &w, S s) noexcept
 Perform the compound left-shift on all the eve::wide lanes and assign the result to current one.
 
template<std::ptrdiff_t V>
auto & operator<<= (wide &w, index_t< V > const &s) noexcept
 Perform the compound left-shift on all the eve::wide lanes with a constant and assign the result to current one.
 
template<integral_value S>
auto operator<< (wide v, S s) noexcept
 Perform the left-shift between all lanes of a eve::wide and an integral scalar.
 
template<std::ptrdiff_t V>
auto operator<< (wide v, index_t< V > const &s) noexcept
 Perform the left-shift between all lanes of a eve::wide and an integral constant.
 
template<integral_value S>
auto & operator>>= (wide &w, S s) noexcept
 Perform the compound right-shift on all the eve::wide lanes and assign the result to current one.
 
template<std::ptrdiff_t V>
auto & operator>>= (wide &w, index_t< V > const &s) noexcept
 Perform the compound right-shift on all the eve::wide lanes and assign the result to current one.
 
template<integral_value S>
auto operator>> (wide v, S s) noexcept
 Perform the right-shift between all lanes of a eve::wide and an integral scalar.
 
template<std::ptrdiff_t V>
auto operator>> (wide v, index_t< V > const &s) noexcept
 Perform the right-shift between all lanes of a eve::wide and an integral constant.
 
auto operator== (wide v, wide w) noexcept
 Element-wise equality comparison of two eve::wide.
 
template<scalar_value S>
requires requires(S s) { wide {s}; }
auto operator== (wide v, S w) noexcept
 Element-wise equality comparison of a eve::wide and a scalar value.
 
template<scalar_value S>
requires requires(S s) { wide {s}; }
auto operator== (S v, wide w) noexcept
 Element-wise equality comparison of a scalar value and a eve::wide.
 
auto operator!= (wide v, wide w) noexcept
 Element-wise inequality comparison of two eve::wide.
 
template<scalar_value S>
requires requires(S s) { wide {s}; }
auto operator!= (wide v, S w) noexcept
 Element-wise inequality comparison of a eve::wide and a scalar value.
 
template<scalar_value S>
requires requires(S s) { wide {s}; }
auto operator!= (S v, wide w) noexcept
 Element-wise inequality comparison of a scalar value and a eve::wide.
 
auto operator< (wide v, wide w) noexcept
 Element-wise less-than comparison between eve::wide.
 
template<scalar_value S>
auto operator< (wide v, S w) noexcept
 Element-wise less-than comparison between a eve::wide and a scalar.
 
template<scalar_value S>
auto operator< (S v, wide w) noexcept
 Element-wise less-than comparison between a scalar and a eve::wide.
 
auto operator> (wide v, wide w) noexcept
 Element-wise greater-than comparison between eve::wide.
 
template<scalar_value S>
auto operator> (wide v, S w) noexcept
 Element-wise greater-than comparison between a eve::wide and a scalar.
 
template<scalar_value S>
auto operator> (S v, wide w) noexcept
 Element-wise greater-than comparison between a scalar and a eve::wide.
 
auto operator>= (wide v, wide w) noexcept
 Element-wise greater-or-equal comparison between eve::wide.
 
template<scalar_value S>
auto operator>= (wide v, S w) noexcept
 Element-wise greater-or-equal comparison between a eve::wide and a scalar.
 
template<scalar_value S>
auto operator>= (S v, wide w) noexcept
 Element-wise greater-or-equal comparison between a scalar and a eve::wide.
 
auto operator<= (wide v, wide w) noexcept
 Element-wise less-or-equal comparison between eve::wide.
 
template<scalar_value S>
auto operator<= (wide v, S w) noexcept
 Element-wise less-or-equal comparison between a eve::wide and a scalar.
 
template<scalar_value S>
auto operator<= (S v, wide w) noexcept
 Element-wise less-or-equal comparison between a scalar and a eve::wide.
 
logical< wideoperator! (wide v) noexcept
 Computes the logical complement of its parameter.
 
std::ostream & operator<< (std::ostream &os, wide p)
 Inserts a eve::wide into a output stream.