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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Class template `basic_mask` <a id="simd.mask.class">[[simd.mask.class]]</a>
|
| 2 |
+
|
| 3 |
+
#### Overview <a id="simd.mask.overview">[[simd.mask.overview]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::simd {
|
| 7 |
+
template<size_t Bytes, class Abi> class basic_mask {
|
| 8 |
+
public:
|
| 9 |
+
using value_type = bool;
|
| 10 |
+
using abi_type = Abi;
|
| 11 |
+
using iterator = simd-iterator<basic_mask>;
|
| 12 |
+
using const_iterator = simd-iterator<const basic_mask>;
|
| 13 |
+
|
| 14 |
+
constexpr iterator begin() noexcept { return {*this, 0}; }
|
| 15 |
+
constexpr const_iterator begin() const noexcept { return {*this, 0}; }
|
| 16 |
+
constexpr const_iterator cbegin() const noexcept { return {*this, 0}; }
|
| 17 |
+
constexpr default_sentinel_t end() const noexcept { return {}; }
|
| 18 |
+
constexpr default_sentinel_t cend() const noexcept { return {}; }
|
| 19 |
+
|
| 20 |
+
static constexpr integral_constant<simd-size-type, simd-size-v<integer-from<Bytes>, Abi>>
|
| 21 |
+
size {};
|
| 22 |
+
|
| 23 |
+
constexpr basic_mask() noexcept = default;
|
| 24 |
+
|
| 25 |
+
// [simd.mask.ctor], basic_mask constructors
|
| 26 |
+
constexpr explicit basic_mask(value_type) noexcept;
|
| 27 |
+
template<size_t UBytes, class UAbi>
|
| 28 |
+
constexpr explicit basic_mask(const basic_mask<UBytes, UAbi>&) noexcept;
|
| 29 |
+
template<class G>
|
| 30 |
+
constexpr explicit basic_mask(G&& gen);
|
| 31 |
+
constexpr basic_mask(const bitset<size()>& b) noexcept;
|
| 32 |
+
constexpr explicit basic_mask(unsigned_integral auto val) noexcept;
|
| 33 |
+
|
| 34 |
+
// [simd.mask.subscr], basic_mask subscript operators
|
| 35 |
+
constexpr value_type operator[](simd-size-type) const;
|
| 36 |
+
template<simd-integral I>
|
| 37 |
+
constexpr resize_t<I::size(), basic_mask> operator[](const I& indices) const;
|
| 38 |
+
|
| 39 |
+
// [simd.mask.unary], basic_mask unary operators
|
| 40 |
+
constexpr basic_mask operator!() const noexcept;
|
| 41 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator+() const noexcept;
|
| 42 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator-() const noexcept;
|
| 43 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator~() const noexcept;
|
| 44 |
+
|
| 45 |
+
// [simd.mask.conv], basic_mask conversions
|
| 46 |
+
template<class U, class A>
|
| 47 |
+
constexpr explicit(sizeof(U) != Bytes) operator basic_vec<U, A>() const noexcept;
|
| 48 |
+
constexpr bitset<size()> to_bitset() const noexcept;
|
| 49 |
+
constexpr unsigned long long to_ullong() const;
|
| 50 |
+
|
| 51 |
+
// [simd.mask.binary], basic_mask binary operators
|
| 52 |
+
friend constexpr basic_mask
|
| 53 |
+
operator&&(const basic_mask&, const basic_mask&) noexcept;
|
| 54 |
+
friend constexpr basic_mask
|
| 55 |
+
operator||(const basic_mask&, const basic_mask&) noexcept;
|
| 56 |
+
friend constexpr basic_mask
|
| 57 |
+
operator&(const basic_mask&, const basic_mask&) noexcept;
|
| 58 |
+
friend constexpr basic_mask
|
| 59 |
+
operator|(const basic_mask&, const basic_mask&) noexcept;
|
| 60 |
+
friend constexpr basic_mask
|
| 61 |
+
operator^(const basic_mask&, const basic_mask&) noexcept;
|
| 62 |
+
|
| 63 |
+
// [simd.mask.cassign], basic_mask compound assignment
|
| 64 |
+
friend constexpr basic_mask&
|
| 65 |
+
operator&=(basic_mask&, const basic_mask&) noexcept;
|
| 66 |
+
friend constexpr basic_mask&
|
| 67 |
+
operator|=(basic_mask&, const basic_mask&) noexcept;
|
| 68 |
+
friend constexpr basic_mask&
|
| 69 |
+
operator^=(basic_mask&, const basic_mask&) noexcept;
|
| 70 |
+
|
| 71 |
+
// [simd.mask.comparison], basic_mask comparisons
|
| 72 |
+
friend constexpr basic_mask
|
| 73 |
+
operator==(const basic_mask&, const basic_mask&) noexcept;
|
| 74 |
+
friend constexpr basic_mask
|
| 75 |
+
operator!=(const basic_mask&, const basic_mask&) noexcept;
|
| 76 |
+
friend constexpr basic_mask
|
| 77 |
+
operator>=(const basic_mask&, const basic_mask&) noexcept;
|
| 78 |
+
friend constexpr basic_mask
|
| 79 |
+
operator<=(const basic_mask&, const basic_mask&) noexcept;
|
| 80 |
+
friend constexpr basic_mask
|
| 81 |
+
operator>(const basic_mask&, const basic_mask&) noexcept;
|
| 82 |
+
friend constexpr basic_mask
|
| 83 |
+
operator<(const basic_mask&, const basic_mask&) noexcept;
|
| 84 |
+
|
| 85 |
+
// [simd.mask.cond], basic_mask exposition only conditional operators
|
| 86 |
+
friend constexpr basic_mask simd-select-impl( // exposition only
|
| 87 |
+
const basic_mask&, const basic_mask&, const basic_mask&) noexcept;
|
| 88 |
+
friend constexpr basic_mask simd-select-impl( // exposition only
|
| 89 |
+
const basic_mask&, same_as<bool> auto, same_as<bool> auto) noexcept;
|
| 90 |
+
template<class T0, class T1>
|
| 91 |
+
friend constexpr vec<see below, size()>
|
| 92 |
+
simd-select-impl(const basic_mask&, const T0&, const T1&) noexcept; // exposition only
|
| 93 |
+
};
|
| 94 |
+
}
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
Every specialization of `basic_mask` is a complete type. The
|
| 98 |
+
specialization of `basic_mask<Bytes, Abi>` is:
|
| 99 |
+
|
| 100 |
+
- disabled, if there is no vectorizable type `T` such that `Bytes` is
|
| 101 |
+
equal to `sizeof(T)`,
|
| 102 |
+
- otherwise, enabled, if there exists a vectorizable type `T` and a
|
| 103 |
+
value `N` in the range \[`1`, `64`\] such that `Bytes` is equal to
|
| 104 |
+
`sizeof(T)` and `Abi` is `deduce-abi-t<T,
|
| 105 |
+
N>`,
|
| 106 |
+
- otherwise, it is *implementation-defined* if such a specialization is
|
| 107 |
+
enabled.
|
| 108 |
+
|
| 109 |
+
If `basic_mask<Bytes, Abi>` is disabled, the specialization has a
|
| 110 |
+
deleted default constructor, deleted destructor, deleted copy
|
| 111 |
+
constructor, and deleted copy assignment. In addition only the
|
| 112 |
+
`value_type` and `abi_type` members are present.
|
| 113 |
+
|
| 114 |
+
If `basic_mask<Bytes, Abi>` is enabled, `basic_mask<Bytes, Abi>` is
|
| 115 |
+
trivially copyable.
|
| 116 |
+
|
| 117 |
+
*Recommended practice:* Implementations should support implicit
|
| 118 |
+
conversions between specializations of `basic_mask` and appropriate
|
| 119 |
+
*implementation-defined* types.
|
| 120 |
+
|
| 121 |
+
[*Note 1*: Appropriate types are non-standard vector types which are
|
| 122 |
+
available in the implementation. — *end note*]
|
| 123 |
+
|
| 124 |
+
#### Constructors <a id="simd.mask.ctor">[[simd.mask.ctor]]</a>
|
| 125 |
+
|
| 126 |
+
``` cpp
|
| 127 |
+
constexpr explicit basic_mask(value_type x) noexcept;
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
*Effects:* Initializes each element with `x`.
|
| 131 |
+
|
| 132 |
+
``` cpp
|
| 133 |
+
template<size_t UBytes, class UAbi>
|
| 134 |
+
constexpr explicit basic_mask(const basic_mask<UBytes, UAbi>& x) noexcept;
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
*Constraints:* `basic_mask<UBytes, UAbi>::size() == size()` is `true`.
|
| 138 |
+
|
| 139 |
+
*Effects:* Initializes the iᵗʰ element with `x[`i`]` for all i in the
|
| 140 |
+
range of \[`0`, `size()`).
|
| 141 |
+
|
| 142 |
+
``` cpp
|
| 143 |
+
template<class G> constexpr explicit basic_mask(G&& gen);
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
*Constraints:* The expression
|
| 147 |
+
`gen(integral_constant<`*`simd-size-type`*`, i>())` is well-formed and
|
| 148 |
+
its type is `bool` for all i in the range of \[`0`, `size()`).
|
| 149 |
+
|
| 150 |
+
*Effects:* Initializes the iᵗʰ element with
|
| 151 |
+
`gen(integral_constant<`*`simd-size-type`*`, i>())` for all i in the
|
| 152 |
+
range of \[`0`, `size()`).
|
| 153 |
+
|
| 154 |
+
*Remarks:* `gen` is invoked exactly once for each i, in increasing order
|
| 155 |
+
of i.
|
| 156 |
+
|
| 157 |
+
``` cpp
|
| 158 |
+
constexpr basic_mask(const bitset<size()>& b) noexcept;
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
*Effects:* Initializes the iᵗʰ element with `b[`i`]` for all i in the
|
| 162 |
+
range \[`0`, `size()`).
|
| 163 |
+
|
| 164 |
+
``` cpp
|
| 165 |
+
constexpr explicit basic_mask(unsigned_integral auto val) noexcept;
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
*Effects:* Initializes the first M elements to the corresponding bit
|
| 169 |
+
values in `val`, where M is the smaller of `size()` and the number of
|
| 170 |
+
bits in the value representation [[basic.types.general]] of the type of
|
| 171 |
+
`val`. If M is less than `size()`, the remaining elements are
|
| 172 |
+
initialized to zero.
|
| 173 |
+
|
| 174 |
+
#### Subscript operator <a id="simd.mask.subscr">[[simd.mask.subscr]]</a>
|
| 175 |
+
|
| 176 |
+
``` cpp
|
| 177 |
+
constexpr value_type operator[](simd-size-type i) const;
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
*Preconditions:* `i >= 0 && i < size()` is `true`.
|
| 181 |
+
|
| 182 |
+
*Returns:* The value of the iᵗʰ element.
|
| 183 |
+
|
| 184 |
+
*Throws:* Nothing.
|
| 185 |
+
|
| 186 |
+
``` cpp
|
| 187 |
+
template<simd-integral I>
|
| 188 |
+
constexpr resize_t<I::size(), basic_mask> operator[](const I& indices) const;
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
*Effects:* Equivalent to: `return permute(*this, indices);`
|
| 192 |
+
|
| 193 |
+
#### Unary operators <a id="simd.mask.unary">[[simd.mask.unary]]</a>
|
| 194 |
+
|
| 195 |
+
``` cpp
|
| 196 |
+
constexpr basic_mask operator!() const noexcept;
|
| 197 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator+() const noexcept;
|
| 198 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator-() const noexcept;
|
| 199 |
+
constexpr basic_vec<integer-from<Bytes>, Abi> operator~() const noexcept;
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
Let *op* be the operator.
|
| 203 |
+
|
| 204 |
+
*Returns:* A data-parallel object where the iᵗʰ element is initialized
|
| 205 |
+
to the results of applying *op* to `operator[](`i`)` for all i in the
|
| 206 |
+
range of \[`0`, `size()`).
|
| 207 |
+
|
| 208 |
+
#### Conversions <a id="simd.mask.conv">[[simd.mask.conv]]</a>
|
| 209 |
+
|
| 210 |
+
``` cpp
|
| 211 |
+
template<class U, class A>
|
| 212 |
+
constexpr explicit(sizeof(U) != Bytes) operator basic_vec<U, A>() const noexcept;
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
*Constraints:* *`simd-size-v`*`<U, A> == `*`simd-size-v`*`<T, Abi>`.
|
| 216 |
+
|
| 217 |
+
*Returns:* A data-parallel object where the iᵗʰ element is initialized
|
| 218 |
+
to `static_cast<U>(operator[](`i`))`.
|
| 219 |
+
|
| 220 |
+
``` cpp
|
| 221 |
+
constexpr bitset<size()> to_bitset() const noexcept;
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
*Returns:* A `bitset<size()>` object where the iᵗʰ element is
|
| 225 |
+
initialized to `operator[](`i`)` for all i in the range \[`0`,
|
| 226 |
+
`size()`).
|
| 227 |
+
|
| 228 |
+
``` cpp
|
| 229 |
+
constexpr unsigned long long to_ullong() const;
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
Let N be the width of `unsigned long long`.
|
| 233 |
+
|
| 234 |
+
*Preconditions:*
|
| 235 |
+
|
| 236 |
+
- `size() <= `N is `true`, or
|
| 237 |
+
- for all i in the range \[N, `size()`), `operator[](`i`)` returns
|
| 238 |
+
`false`.
|
| 239 |
+
|
| 240 |
+
*Returns:* The integral value corresponding to the bits in `*this`.
|
| 241 |
+
|
| 242 |
+
*Throws:* Nothing.
|
| 243 |
+
|