From Jason Turner

[simd.permute.mask]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppt64nkz7/{from.md → to.md} +65 -0
tmp/tmppt64nkz7/{from.md → to.md} RENAMED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Mask permute <a id="simd.permute.mask">[[simd.permute.mask]]</a>
2
+
3
+ ``` cpp
4
+ template<simd-vec-type V>
5
+ constexpr V compress(const V& v, const typename V::mask_type& selector);
6
+ template<simd-mask-type M>
7
+ constexpr M compress(const M& v, const type_identity_t<M>& selector);
8
+ ```
9
+
10
+ Let:
11
+
12
+ - *`bit-index`*`(`i`)` be a function which returns the index of the iᵗʰ
13
+ element of `selector` that is `true`.
14
+ - *`select-value`*`(`i`)` be a function which returns
15
+ `v[`*`bit-index`*`(`i`)]` for i in the range \[`0`,
16
+ `reduce_count(selector)`) and a valid but unspecified value otherwise.
17
+ \[*Note 1*: Different calls to *`select-value`* can return different
18
+ unspecified values. — *end note*]
19
+
20
+ *Returns:* A data-parallel object where the iᵗʰ element is initialized
21
+ to the result of *`select-value`*`(`i`)` for all i in the range \[`0`,
22
+ `V::size()`).
23
+
24
+ ``` cpp
25
+ template<simd-vec-type V>
26
+ constexpr V compress(const V& v, const typename V::mask_type& selector,
27
+ const typename V::value_type& fill_value);
28
+ template<simd-mask-type M>
29
+ constexpr M compress(const M& v, const type_identity_t<M>& selector,
30
+ const typename M::value_type& fill_value);
31
+ ```
32
+
33
+ Let:
34
+
35
+ - *`bit-index`*`(`i`)` be a function which returns the index of the iᵗʰ
36
+ element of `selector` that is `true`.
37
+ - *`select-value`*`(`i`)` be a function which returns
38
+ `v[`*`bit-index`*`(`i`)]` for i in the range \[`0`,
39
+ `reduce_count(selector)`) and `fill_value` otherwise.
40
+
41
+ *Returns:* A data-parallel object where the iᵗʰ element is initialized
42
+ to the result of *`select-value`*`(`i`)` for all i in the range \[`0`,
43
+ `V::size()`).
44
+
45
+ ``` cpp
46
+ template<simd-vec-type V>
47
+ constexpr V expand(const V& v, const typename V::mask_type& selector, const V& original = {});
48
+ template<simd-mask-type M>
49
+ constexpr M expand(const M& v, const type_identity_t<M>& selector, const M& original = {});
50
+ ```
51
+
52
+ Let:
53
+
54
+ - *set-indices* be a list of the index positions of `true` elements in
55
+ `selector`, in ascending order.
56
+ - *`bit-lookup`*`(`b`)` be a function which returns the index where b
57
+ appears in *`set-indices`*.
58
+ - *`select-value`*`(`i`)` be a function which returns
59
+ `v[`*`bit-lookup`*`(`i`)]` if `selector[`i`]` is `true`, otherwise
60
+ returns `original[`i`]`.
61
+
62
+ *Returns:* A data-parallel object where the iᵗʰ element is initialized
63
+ to the result of *`select-value`*`(`i`)` for all i in the range \[`0`,
64
+ `V::size()`).
65
+