29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.10 Non-member operations [simd.mask.nonmembers]

29.10.10.1 basic_mask binary operators [simd.mask.binary]

friend constexpr basic_mask operator&&(const basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask operator||(const basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask operator& (const basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask operator| (const basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask operator^ (const basic_mask& lhs, const basic_mask& rhs) noexcept;
Let op be the operator.
Returns: A basic_mask object initialized with the results of applying op to lhs and rhs as a binary element-wise operation.

29.10.10.2 basic_mask compound assignment [simd.mask.cassign]

friend constexpr basic_mask& operator&=(basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask& operator|=(basic_mask& lhs, const basic_mask& rhs) noexcept; friend constexpr basic_mask& operator^=(basic_mask& lhs, const basic_mask& rhs) noexcept;
Let op be the operator.
Effects: These operators apply op to lhs and rhs as a binary element-wise operation.
Returns: lhs.

29.10.10.3 basic_mask comparisons [simd.mask.comparison]

friend constexpr basic_mask operator==(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator!=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator>=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator<=(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator>(const basic_mask&, const basic_mask&) noexcept; friend constexpr basic_mask operator<(const basic_mask&, const basic_mask&) noexcept;
Let op be the operator.
Returns: A basic_mask object initialized with the results of applying op to lhs and rhs as a binary element-wise operation.

29.10.10.4 basic_mask exposition only conditional operators [simd.mask.cond]

friend constexpr basic_mask simd-select-impl( const basic_mask& mask, const basic_mask& a, const basic_mask& b) noexcept;
Returns: A basic_mask object where the element equals mask[i] ? a[i] : b[i] for all i in the range of [0, size()).
friend constexpr basic_mask simd-select-impl(const basic_mask& mask, same_as<bool> auto a, same_as<bool> auto b) noexcept;
Returns: A basic_mask object where the element equals mask[i] ? a : b for all i in the range of [0, size()).
template<class T0, class T1> friend constexpr vec<see below, size()> simd-select-impl(const basic_mask& mask, const T0& a, const T1& b) noexcept;
Constraints:
  • same_as<T0, T1> is true,
  • T0 is a vectorizable type, and
  • sizeof(T0) == Bytes.
Returns: A vec<T0, size()> object where the element equals mask[i] ? a : b for all i in the range of [0, size()).

29.10.10.5 basic_mask reductions [simd.mask.reductions]

template<size_t Bytes, class Abi> constexpr bool all_of(const basic_mask<Bytes, Abi>& k) noexcept;
Returns: true if all boolean elements in k are true, otherwise false.
template<size_t Bytes, class Abi> constexpr bool any_of(const basic_mask<Bytes, Abi>& k) noexcept;
Returns: true if at least one boolean element in k is true, otherwise false.
template<size_t Bytes, class Abi> constexpr bool none_of(const basic_mask<Bytes, Abi>& k) noexcept;
Returns: !any_of(k).
template<size_t Bytes, class Abi> constexpr simd-size-type reduce_count(const basic_mask<Bytes, Abi>& k) noexcept;
Returns: The number of boolean elements in k that are true.
template<size_t Bytes, class Abi> constexpr simd-size-type reduce_min_index(const basic_mask<Bytes, Abi>& k);
Preconditions: any_of(k) is true.
Returns: The lowest element index i where k[i] is true.
template<size_t Bytes, class Abi> constexpr simd-size-type reduce_max_index(const basic_mask<Bytes, Abi>& k);
Preconditions: any_of(k) is true.
Returns: The greatest element index i where k[i] is true.
constexpr bool all_of(same_as<bool> auto x) noexcept; constexpr bool any_of(same_as<bool> auto x) noexcept; constexpr simd-size-type reduce_count(same_as<bool> auto x) noexcept;
Returns: x.
constexpr bool none_of(same_as<bool> auto x) noexcept;
Returns: !x.
constexpr simd-size-type reduce_min_index(same_as<bool> auto x); constexpr simd-size-type reduce_max_index(same_as<bool> auto x);
Preconditions: x is true.
Returns: 0.