From Jason Turner

[simd.expos]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps061v3jm/{from.md → to.md} +222 -0
tmp/tmps061v3jm/{from.md → to.md} RENAMED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Exposition-only types, variables, and concepts <a id="simd.expos">[[simd.expos]]</a>
2
+
3
+ ``` cpp
4
+ using simd-size-type = see belownc; // exposition only
5
+ template<size_t Bytes> using integer-from = see belownc; // exposition only
6
+
7
+ template<class T, class Abi>
8
+ constexpr simd-size-type simd-size-v = see belownc; // exposition only
9
+ template<class T> constexpr size_t mask-element-size = see belownc; // exposition only
10
+
11
+ template<class T>
12
+ concept constexpr-wrapper-like = // exposition only
13
+ convertible_to<T, decltype(T::value)> &&
14
+ equality_comparable_with<T, decltype(T::value)> &&
15
+ bool_constant<T() == T::value>::value &&
16
+ bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;
17
+
18
+ template<class T> using deduced-vec-t = see belownc; // exposition only
19
+
20
+ template<class V, class T> using make-compatible-simd-t = see belownc; // exposition only
21
+
22
+ template<class V>
23
+ concept simd-vec-type = // exposition only
24
+ same_as<V, basic_vec<typename V::value_type, typename V::abi_type>> &&
25
+ is_default_constructible_v<V>;
26
+
27
+ template<class V>
28
+ concept simd-mask-type = // exposition only
29
+ same_as<V, basic_mask<mask-element-size<V>, typename V::abi_type>> &&
30
+ is_default_constructible_v<V>;
31
+
32
+ template<class V>
33
+ concept simd-floating-point = // exposition only
34
+ simd-vec-type<V> && floating_point<typename V::value_type>;
35
+
36
+ template<class V>
37
+ concept simd-integral = // exposition only
38
+ simd-vec-type<V> && integral<typename V::value_type>;
39
+
40
+ template<class V>
41
+ using simd-complex-value-type = V::value_type::value_type; // exposition only
42
+
43
+ template<class V>
44
+ concept simd-complex = // exposition only
45
+ simd-vec-type<V> && same_as<typename V::value_type, complex<simd-complex-value-type<V>>>;
46
+
47
+ template<class... Ts>
48
+ concept math-floating-point = // exposition only
49
+ (exposition onlyconceptnc{simd-floating-point}<deduced-vec-t<Ts>> || ...);
50
+
51
+ template<class... Ts>
52
+ requires exposition onlyconceptnc{math-floating-point}<Ts...>
53
+ using math-common-simd-t = see belownc; // exposition only
54
+
55
+ template<class BinaryOperation, class T>
56
+ concept exposition onlyconceptnc{reduction-binary-operation} = see belownc; // exposition only
57
+
58
+ // [simd.expos.abi], simd ABI tags
59
+ template<class T> using native-abi = see belownc; // exposition only
60
+ template<class T, simd-size-type N> using deduce-abi-t = see belownc@; // exposition only
61
+
62
+ // [simd.flags], load and store flags
63
+ struct convert-flag; // exposition only
64
+ struct aligned-flag; // exposition only
65
+ template<size_t N> struct overaligned-flag; // exposition only
66
+ ```
67
+
68
+ #### Exposition-only helpers <a id="simd.expos.defn">[[simd.expos.defn]]</a>
69
+
70
+ ``` cpp
71
+ using simd-size-type = see below;
72
+ ```
73
+
74
+ *simd-size-type* is an alias for a signed integer type.
75
+
76
+ ``` cpp
77
+ template<size_t Bytes> using integer-from = see below;
78
+ ```
79
+
80
+ *`integer-from`*`<Bytes>` is an alias for a signed integer type `T` such
81
+ that `sizeof(T)` equals `Bytes`.
82
+
83
+ ``` cpp
84
+ template<class T, class Abi>
85
+ constexpr simd-size-type simd-size-v = see below;
86
+ ```
87
+
88
+ *`simd-size-v`*`<T, Abi>` denotes the width of `basic_vec<T, Abi>` if
89
+ the specialization `basic_vec<T, Abi>` is enabled, or `0` otherwise.
90
+
91
+ ``` cpp
92
+ template<class T> constexpr size_t mask-element-size = see below;
93
+ ```
94
+
95
+ *`mask-element-size`*`<basic_mask<Bytes, Abi>>` has the value `Bytes`.
96
+
97
+ ``` cpp
98
+ template<class T> using deduced-vec-t = see below;
99
+ ```
100
+
101
+ Let `x` denote an lvalue of type `const T`.
102
+
103
+ *`deduced-vec-t`*`<T>` is an alias for
104
+
105
+ - `decltype(x + x)`, if the type of `x + x` is an enabled specialization
106
+ of `basic_vec`; otherwise
107
+ - `void`.
108
+
109
+ ``` cpp
110
+ template<class V, class T> using make-compatible-simd-t = see below;
111
+ ```
112
+
113
+ Let `x` denote an lvalue of type `const T`.
114
+
115
+ *`make-compatible-simd-t`*`<V, T>` is an alias for
116
+
117
+ - *`deduced-vec-t`*`<T>`, if that type is not `void`, otherwise
118
+ - `vec<decltype(x + x), V::size()>`.
119
+
120
+ ``` cpp
121
+ template<class... Ts>
122
+ requires math-floating-point<Ts...>
123
+ using math-common-simd-t = see below;
124
+ ```
125
+
126
+ Let `T0` denote `Ts...[0]`. Let `T1` denote `Ts...[1]`. Let `TRest`
127
+ denote a pack such that `T0, T1, TRest...` is equivalent to `Ts...`.
128
+
129
+ Let *`math-common-simd-t`*`<Ts...>` be an alias for
130
+
131
+ - *`deduced-vec-t`*`<T0>`, if `sizeof...(Ts)` equals 1; otherwise
132
+ - `common_type_t<`*`deduced-vec-t`*`<T0>, `*`deduced-vec-t`*`<T1>>`, if
133
+ `sizeof...(Ts)` equals 2 and
134
+ `math-floating-point<T0> && math-floating-point<T1>` is `true`;
135
+ otherwise
136
+ - `common_type_t<`*`deduced-vec-t`*`<T0>, T1>`, if `sizeof...(Ts)`
137
+ equals 2 and *`math-floating-point`*`<T0>` is `true`; otherwise
138
+ - `common_type_t<T0, `*`deduced-vec-t`*`<T1>>`, if `sizeof...(Ts)`
139
+ equals 2; otherwise
140
+ - `common_type_t<`*`math-common-simd-t`*`<T0, T1>, TRest...>`, if
141
+ *`math-common-simd-t`*`<T0, T1>` is valid and denotes a type;
142
+ otherwise
143
+ - `common_type_t<`*`math-common-simd-t`*`<TRest...>, T0, T1>`.
144
+
145
+ ``` cpp
146
+ template<class BinaryOperation, class T>
147
+ concept reduction-binary-operation =
148
+ requires (const BinaryOperation binary_op, const vec<T, 1> v) {
149
+ { binary_op(v, v) } -> same_as<vec<T, 1>>;
150
+ };
151
+ ```
152
+
153
+ Types `BinaryOperation` and `T` model
154
+ `reduction-binary-operation<BinaryOperation, T>` only if:
155
+
156
+ - `BinaryOperation` is a binary element-wise operation and the operation
157
+ is commutative.
158
+ - An object of type `BinaryOperation` can be invoked with two arguments
159
+ of type `basic_vec<T, Abi>`, with unspecified ABI tag `Abi`, returning
160
+ a `basic_vec<T, Abi>`.
161
+
162
+ #### `simd` ABI tags <a id="simd.expos.abi">[[simd.expos.abi]]</a>
163
+
164
+ ``` cpp
165
+ template<class T> using native-abi = see below;
166
+ template<class T, simd-size-type N> using deduce-abi-t = see below;
167
+ ```
168
+
169
+ An *ABI tag* is a type that indicates a choice of size and binary
170
+ representation for objects of data-parallel type.
171
+
172
+ [*Note 1*: The intent is for the size and binary representation to
173
+ depend on the target architecture and compiler flags. The ABI tag,
174
+ together with a given element type, implies the width. — *end note*]
175
+
176
+ [*Note 2*: The ABI tag is orthogonal to selecting the machine
177
+ instruction set. The selected machine instruction set limits the usable
178
+ ABI tag types, though (see [[simd.overview]]). The ABI tags enable users
179
+ to safely pass objects of data-parallel type between translation unit
180
+ boundaries (e.g., function calls or I/O). — *end note*]
181
+
182
+ An implementation defines ABI tag types as necessary for the following
183
+ aliases.
184
+
185
+ *`deduce-abi-t`*`<T, N>` is defined if
186
+
187
+ - `T` is a vectorizable type,
188
+ - `N` is greater than zero, and
189
+ - `N` is not larger than an implementation-defined maximum.
190
+
191
+ The *implementation-defined* maximum for `N` is not smaller than 64 and
192
+ can differ depending on `T`.
193
+
194
+ Where present, *`deduce-abi-t`*`<T, N>` names an ABI tag type such that
195
+
196
+ - *`simd-size-v`*`<T, `*`deduce-abi-t`*`<T, N>>` equals `N`,
197
+ - `basic_vec<T, `*`deduce-abi-t`*`<T, N>>` is enabled [[simd.overview]],
198
+ and
199
+ - `basic_mask<sizeof(T), `*`deduce-abi-t`*`<`*`integer-from`*`<sizeof(T)>, N>>`
200
+ is enabled.
201
+
202
+ *`native-abi`*`<T>` is an *implementation-defined* alias for an ABI tag.
203
+ `basic_vec<T, `*`native-abi`*`<T>>` is an enabled specialization.
204
+
205
+ [*Note 3*: The intent is to use the ABI tag producing the most
206
+ efficient data-parallel execution for the element type `T` on the
207
+ currently targeted system. For target architectures with ISA extensions,
208
+ compiler flags can change the type of the *`native-abi`*`<T>`
209
+ alias. — *end note*]
210
+
211
+ [*Example 1*:
212
+
213
+ Consider a target architecture supporting the ABI tags `__simd128` and
214
+ `__simd256`, where hardware support for `__simd256` exists only for
215
+ floating-point types. The implementation therefore defines
216
+ *`native-abi`*`<T>` as an alias for
217
+
218
+ - `__simd256` if `T` is a floating-point type, and
219
+ - `__simd128` otherwise.
220
+
221
+ — *end example*]
222
+