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 from the last lane.
 
auto front () const noexcept
 Retrieve the value from 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
 Performs a bitwise complement on all the wide lanes.
 
template<value V>
wideoperator&= (wide &w, V o) noexcept
 Performs a compound bitwise and on all the wide lanes and assign the result to the current one.
 
template<scalar_value U, typename M >
wide operator& (wide const &a, wide< U, M > const &b) noexcept
 Performs a bitwise and between all lanes of two wide instances. Do not participate to overload resolution if both wide doesnot have the same sizeof
 
template<scalar_value S>
wide operator& (wide const &w, S s) noexcept
 Performs 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>
wide< S, Cardinal > operator& (S s, wide const &w) noexcept
 Performs 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>
wideoperator|= (wide &w, V o) noexcept
 Performs a Compound bitwise or on all the wide lanes and assign the result to the current one.
 
template<scalar_value U, typename M >
wide operator| (wide const &a, wide< U, M > const &b) noexcept
 Performs 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>
wide operator| (wide const &w, S s) noexcept
 Performs 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>
wide< S, Cardinal > operator| (S s, wide const &w) noexcept
 Performs 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>
wideoperator^= (wide &w, V o) noexcept
 Performs a bitwise xor on all the wide lanes and assign the result to the current one.
 
template<scalar_value U, typename M >
wide operator^ (wide const &a, wide< U, M > const &b) noexcept
 Performs 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>
wide operator^ (wide const &w, S s) noexcept
 Performs 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>
wide< S, Cardinal > operator^ (S s, wide const &w) noexcept
 Performs a bitwise xor between all lanes of a scalar and a eve::wide Do not participate to overload resolution if sizeof(Type) != sizeof(S)
 
wide operator+ (wide const &v) noexcept
 Unary plus operator.
 
wide operator- (wide const &v) noexcept
 Unary minus operator. See also: eve::minus.
 
template<value V>
requires (!kumi::product_type<Type>)
wideoperator+= (wide &w, V v) noexcept
 Performs the compound addition on all the wide lanes and assign the result to the current one. See also: eve::add.
 
wide operator+ (wide const &a, wide const &b) noexcept
 Performs the addition between all lanes of its parameters See also: eve::add.
 
wide operator+ (plain_scalar_value auto s, wide const &v) noexcept
 Performs the addition between a scalar and all lanes of a eve::wide See also: eve::add.
 
wide operator+ (wide const &v, plain_scalar_value auto s) noexcept
 Performs the addition between all lanes of a eve::wide and a scalar See also: eve::add.
 
template<value V>
requires (!kumi::product_type<Type>)
wideoperator-= (wide &w, V v) noexcept
 Performs the compound difference on all the wide lanes and assign the result to the current one. See also: eve::sub.
 
wide operator- (wide const &a, wide const &b) noexcept
 Performs the difference between all lanes of its parameters See also: eve::sub.
 
wide operator- (plain_scalar_value auto s, wide const &w) noexcept
 Performs the difference between a scalar and all lanes of a eve::wide See also: eve::sub.
 
wide operator- (wide const &w, plain_scalar_value auto s) noexcept
 Performs the difference between all lanes of a eve::wide and a scalar See also: eve::sub.
 
template<value V>
requires (!kumi::product_type<Type>)
wideoperator*= (wide &w, V o) noexcept
 Performs the compound product on all the wide lanes and assign the result to the current one. See also: eve::mul.
 
wide operator* (wide const &a, wide const &b) noexcept
 Performs the product between all lanes of its parameters See also: eve::mul.
 
wide operator* (plain_scalar_value auto s, wide const &w) noexcept
 Performs the product between a scalar and all lanes of a eve::wide See also: eve::mul.
 
wide operator* (wide const &w, plain_scalar_value auto s) noexcept
 Performs the product between all lanes of a eve::wide and a scalar See also: eve::mul.
 
template<value V>
requires (!kumi::product_type<Type>)
wideoperator/= (wide &w, V o) noexcept
 Performs the compound division on all the wide lanes and assign the result to the current one. See also: eve::div.
 
wide operator/ (wide const &a, wide const &b) noexcept
 Performs the division between all lanes of its parameters See also: eve::div.
 
wide operator/ (plain_scalar_value auto s, wide const &w) noexcept
 Performs the division between a scalar and all lanes of a eve::wide See also: eve::div.
 
wide operator/ (wide const &v, plain_scalar_value auto s) noexcept
 Performs the division between all lanes of a eve::wide and a scalar See also: eve::div.
 
template<integral_value V>
wideoperator%= (wide &w, V o) noexcept
 Performs 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.
 
wide operator% (wide const &a, wide const &b) noexcept
 Performs 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 &w) noexcept
 Performs 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 &w, integral_scalar_value auto s) noexcept
 Performs 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>
wideoperator<<= (wide &w, S s) noexcept
 Performs the compound left-shift on all the eve::wide lanes and assign the result to current one.
 
template<std::ptrdiff_t V>
wideoperator<<= (wide &w, index_t< V > const &s) noexcept
 Performs the compound left-shift on all the eve::wide lanes with a constant and assign the result to current one.
 
template<integral_value S>
wide operator<< (wide w, S s) noexcept
 Performs the left-shift between all lanes of a eve::wide and an integral scalar.
 
template<std::ptrdiff_t V>
wide operator<< (wide w, index_t< V > const &s) noexcept
 Performs the left-shift between all lanes of a eve::wide and an integral constant.
 
template<integral_value S>
wideoperator>>= (wide &w, S s) noexcept
 Performs the compound right-shift on all the eve::wide lanes and assign the result to current one.
 
template<std::ptrdiff_t V>
wideoperator>>= (wide &w, index_t< V > const &s) noexcept
 Performs the compound right-shift on all the eve::wide lanes and assign the result to current one.
 
template<integral_value S>
wide operator>> (wide w, S s) noexcept
 Performs the right-shift between all lanes of a eve::wide and an integral scalar.
 
template<std::ptrdiff_t V>
auto operator>> (wide w, index_t< V > const &s) noexcept
 Performs 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 negation of its parameter.
 
std::ostream & operator<< (std::ostream &os, wide p)
 Inserts a eve::wide into a output stream.