tmp/tmpdbgjjz0z/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Static permute <a id="simd.permute.static">[[simd.permute.static]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<simd-size-type N = see below, simd-vec-type V, class IdxMap>
|
| 5 |
+
constexpr resize_t<N, V> permute(const V& v, IdxMap&& idxmap);
|
| 6 |
+
template<simd-size-type N = see below, simd-mask-type M, class IdxMap>
|
| 7 |
+
constexpr resize_t<N, M> permute(const M& v, IdxMap&& idxmap);
|
| 8 |
+
```
|
| 9 |
+
|
| 10 |
+
Let:
|
| 11 |
+
|
| 12 |
+
- *`gen-fn`*`(i)` be `idxmap(i, V::size())` if that expression is
|
| 13 |
+
well-formed, and `idxmap(i)` otherwise.
|
| 14 |
+
- *perm-fn* be the following exposition-only function template:
|
| 15 |
+
``` cpp
|
| 16 |
+
template<simd-size-type I>
|
| 17 |
+
typename V::value_type perm-fn() {
|
| 18 |
+
constexpr auto src_index = gen-fn(I);
|
| 19 |
+
if constexpr (src_index == zero_element) {
|
| 20 |
+
return typename V::value_type();
|
| 21 |
+
} else if constexpr (src_index == uninit_element) {
|
| 22 |
+
return unspecified-value;
|
| 23 |
+
} else {
|
| 24 |
+
return v[src_index];
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
*Constraints:* At least one of
|
| 30 |
+
`invoke_result_t<IdxMap&, `*`simd-size-type`*`>` and
|
| 31 |
+
`invoke_result_t<IdxMap&, `*`simd-size-type`*`, `*`simd-size-type`*`>`
|
| 32 |
+
satisfies `integral`.
|
| 33 |
+
|
| 34 |
+
*Mandates:* *`gen-fn`*`(`i`)` is a constant expression whose value is
|
| 35 |
+
`zero_element`, `uninit_element`, or in the range \[`0`, `V::size()`),
|
| 36 |
+
for all i in the range \[`0`, `N`).
|
| 37 |
+
|
| 38 |
+
*Returns:* A data-parallel object where the iᵗʰ element is initialized
|
| 39 |
+
to the result of *`perm-fn`*`<`i`>()` for all i in the range \[`0`,
|
| 40 |
+
`N`).
|
| 41 |
+
|
| 42 |
+
*Remarks:* The default argument for template parameter `N` is
|
| 43 |
+
`V::size()`.
|
| 44 |
+
|