E.V.E
v2022.03.00
eve::logical< wide< Type, Cardinal > > Struct Template Reference

Wrapper for SIMD registers holding logical types with compile-time size. More...

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

Detailed Description

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

Wrapper for SIMD registers holding logical types with compile-time size.

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

This specialization of eve::logical is an architecture-agnostic representation of a low-level SIMD register mask 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 = logical< 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 bits_type = wide< as_integer_t< Type, unsigned >, Cardinal >
 Type representing the bits of the logical value.
 
using mask_type = wide< Type, Cardinal >
 Type representing the numerical value associated to the mask.
 
template<typename T , typename N = expected_cardinal_t<T>>
using rebind = logical< 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 = logical< wide< Type, N > >
 Generates a eve::wide type from a different cardinal N.
 

Public Member Functions

auto bits () const noexcept
 Computes a eve::wide containing the bit pattern of current logical. This bit patterns is contained in a eve::wide of unsigned integral.
 
auto mask () const noexcept
 Computes a eve::wide containing the bit pattern of current logical. This bit patterns is contained in a eve::wide of Type.
 
auto bitmap () const noexcept
 Returns a bitset corresponding to the current logical values.
 
Constructors
 logical ()=default
 Default constructor.
 
 logical (storage_type const &r) noexcept
 Constructs from ABI-specific storage.
 
template<std::input_iterator Iterator>
 logical (Iterator b, Iterator e) noexcept
 Constructs a eve::logical 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, Range>)
 logical (Range &&r) noexcept
 Constructs a eve::logical 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< logical > Ptr>
 logical (Ptr ptr) noexcept
 Constructs a eve::logical from a SIMD compatible pointer.
 
template<scalar_value S>
 logical (S v) noexcept
 Constructs a eve::logical by splatting a scalar value in all lanes.
 
template<typename T0 , typename T1 , typename... Ts>
requires ( std::convertible_to<T0,logical<Type>> && std::convertible_to<T0,logical<Type>> && (... && std::convertible_to<Ts,logical<Type>>) && (Cardinal::value == 2 + sizeof...(Ts)) )
 logical (T0 const &v0, T1 const &v1, Ts const &... vs) noexcept
 Constructs a eve::logical from a sequence of scalar values of proper size.
 
template<eve::invocable< size_type, size_type > Generator>
 logical (Generator &&g) noexcept
 Constructs a eve::logical from a Callable Object. More...
 
template<typename Half >
 logical (logical< wide< Type, Half > > const &l, logical< wide< Type, Half > > const &h) noexcept
 Constructs a eve::logical by combining two eve::logical of half the current cardinal. Does not participate in overload resolution if Cardinal::value != 2 * Half::value.
 
Assignment operators
logicaloperator= (logical< Type > v) noexcept
 Assignment of a logical value by splatting it in all lanes.
 
logicaloperator= (bool v) noexcept
 Assignment of a boolean value by splatting it in all lanes.
 
logicaloperator= (storage_type const &r)
 Assignment of an architecture-specific SIMD register.
 
Modifiers
void swap (logical &other)
 Exchange this value with another eve::logical.
 
Sequence interface
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::logical into two eve::logical of half cardinal. Does not participate in overload resolution if Cardinal::value == 1. More...
 
template<std::size_t Slice>
auto slice (slice_t< Slice > s) const
 Return the upper or lower half-sized slice of a eve::logical. Does not participate in overload resolution if Cardinal::value == 1. More...
 

Static Public Member Functions

static constexpr auto alignment () noexcept
 Returns the alignment expected to be used to store a eve::logical.
 
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

template<typename U >
auto operator&& (logical const &v, logical< wide< U, Cardinal > > const &w) noexcept
 Perform a logical and operation between two eve::logical.
 
template<scalar_value S>
auto operator&& (logical const &v, S w) noexcept
 Perform a logical and operation between a eve::logical and a scalar.
 
template<scalar_value S>
auto operator&& (S v, logical const &w) noexcept
 Perform a logical and operation between a scalar and a eve::logical.
 
template<typename U >
auto operator|| (logical const &v, logical< wide< U, Cardinal > > const &w) noexcept
 Perform a logical or operation between two eve::logical.
 
auto operator|| (logical const &v, scalar_value auto w) noexcept
 Perform a logical or operation between a eve::logical and a scalar.
 
auto operator|| (scalar_value auto v, logical const &w) noexcept
 Perform a logical or operation between a scalar and a eve::logical.
 
auto operator! (logical const &v) noexcept
 Computes the logical complement of its parameter.
 
void swap (logical &lhs, logical &rhs) noexcept
 Swaps the contents of lhs and rhs by calling lhs.swap(rhs).
 
logical operator== (logical v, logical w) noexcept
 Element-wise equality comparison of two eve::logical.
 
template<scalar_value S>
requires requires(S s) { logical{s}; }
logical operator== (logical v, S w) noexcept
 Element-wise equality comparison of a eve::logical and a scalar value.
 
template<scalar_value S>
requires requires(S s) { logical{s}; }
logical operator== (S v, logical w) noexcept
 Element-wise equality comparison of a scalar value and a eve::logical.
 
logical operator!= (logical v, logical w) noexcept
 Element-wise inequality comparison of two eve::logical.
 
template<scalar_value S>
requires requires(S s) { logical{s}; }
logical operator!= (logical v, S w) noexcept
 Element-wise inequality comparison of a eve::logical and a scalar value.
 
template<scalar_value S>
requires requires(S s) { logical{s}; }
logical operator!= (S v, logical w) noexcept
 Element-wise inequality comparison of a scalar value and a eve::logical.
 
std::ostream & operator<< (std::ostream &os, logical const &p)
 Inserts a eve::wide into a output stream.