183 lines
5.3 KiB
Markdown
183 lines
5.3 KiB
Markdown
[simd.expos.defn]
|
||
|
||
# 29 Numerics library [[numerics]](./#numerics)
|
||
|
||
## 29.10 Data-parallel types [[simd]](simd#expos.defn)
|
||
|
||
### 29.10.2 Exposition-only types, variables, and concepts [[simd.expos]](simd.expos#defn)
|
||
|
||
#### 29.10.2.1 Exposition-only helpers [simd.expos.defn]
|
||
|
||
[ð](#itemdecl:1)
|
||
|
||
`using simd-size-type = see below;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16280)
|
||
|
||
*simd-size-type* is an alias for a signed integer type[.](#1.sentence-1)
|
||
|
||
[ð](#itemdecl:2)
|
||
|
||
`template<size_t Bytes> using integer-from = see below;
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16289)
|
||
|
||
*integer-from*<Bytes> is an alias for a signed integer typeT such that sizeof(T) equals Bytes[.](#2.sentence-1)
|
||
|
||
[ð](#itemdecl:3)
|
||
|
||
`template<class T, class Abi>
|
||
constexpr simd-size-type simd-size-v = see below;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16300)
|
||
|
||
*simd-size-v*<T, Abi> denotes the width of basic_vec<T,
|
||
Abi> if the specialization basic_vec<T, Abi> is enabled, or 0 otherwise[.](#3.sentence-1)
|
||
|
||
[ð](#itemdecl:4)
|
||
|
||
`template<class T> constexpr size_t mask-element-size = see below;
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16311)
|
||
|
||
*mask-element-size*<basic_mask<Bytes, Abi>> has the valueBytes[.](#4.sentence-1)
|
||
|
||
[ð](#itemdecl:5)
|
||
|
||
`template<class T> using deduced-vec-t = see below;
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16321)
|
||
|
||
Let x denote an lvalue of type const T[.](#5.sentence-1)
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16324)
|
||
|
||
*deduced-vec-t*<T> is an alias for
|
||
|
||
- [(6.1)](#6.1)
|
||
|
||
decltype(x + x), if the type of x + x is an enabled
|
||
specialization of basic_vec; otherwise
|
||
|
||
- [(6.2)](#6.2)
|
||
|
||
void[.](#6.sentence-1)
|
||
|
||
[ð](#itemdecl:6)
|
||
|
||
`template<class V, class T> using make-compatible-simd-t = see below;
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16340)
|
||
|
||
Let x denote an lvalue of type const T[.](#7.sentence-1)
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16343)
|
||
|
||
*make-compatible-simd-t*<V, T> is an alias for
|
||
|
||
- [(8.1)](#8.1)
|
||
|
||
*deduced-vec-t*<T>, if that type is not void,
|
||
otherwise
|
||
|
||
- [(8.2)](#8.2)
|
||
|
||
vec<decltype(x + x), V::size()>[.](#8.sentence-1)
|
||
|
||
[ð](#itemdecl:7)
|
||
|
||
`template<class... Ts>
|
||
requires [math-floating-point](simd.expos#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<Ts...>
|
||
using math-common-simd-t = see below;
|
||
`
|
||
|
||
[9](#9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16361)
|
||
|
||
Let T0 denote Ts...[0][.](#9.sentence-1)
|
||
|
||
Let T1 denote Ts...[1][.](#9.sentence-2)
|
||
|
||
Let TRest denote a pack such that T0, T1, TRest... is equivalent
|
||
to Ts...[.](#9.sentence-3)
|
||
|
||
[10](#10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16367)
|
||
|
||
Let *math-common-simd-t*<Ts...> be an alias for
|
||
|
||
- [(10.1)](#10.1)
|
||
|
||
*deduced-vec-t*<T0>, if sizeof...(Ts) equals 1;
|
||
otherwise
|
||
|
||
- [(10.2)](#10.2)
|
||
|
||
common_type_t<*deduced-vec-t*<T0>, *deduced-vec-t*<T1>>, if sizeof...(Ts) equals 2 and [*math-floating-point*](simd.expos#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<T0> &&[*math-floating-point*](simd.expos#concept:math-floating-point "29.10.2 Exposition-only types, variables, and concepts [simd.expos]")<T1> is true; otherwise
|
||
|
||
- [(10.3)](#10.3)
|
||
|
||
common_type_t<*deduced-vec-t*<T0>, T1>, if sizeof...(Ts) equals 2 and *math-floating-point*<T0> is true; otherwise
|
||
|
||
- [(10.4)](#10.4)
|
||
|
||
common_type_t<T0, *deduced-vec-t*<T1>>, if sizeof...(Ts) equals 2; otherwise
|
||
|
||
- [(10.5)](#10.5)
|
||
|
||
common_type_t<*math-common-simd-t*<T0, T1>, TRest...>, if *math-common-simd-t*<T0, T1> is valid and denotes a type;
|
||
otherwise
|
||
|
||
- [(10.6)](#10.6)
|
||
|
||
common_type_t<*math-common-simd-t*<TRest...>, T0, T1>[.](#10.sentence-1)
|
||
|
||
[ð](#concept:reduction-binary-operation)
|
||
|
||
`template<class BinaryOperation, class T>
|
||
concept [reduction-binary-operation](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]") =
|
||
requires (const BinaryOperation binary_op, const vec<T, 1> v) {
|
||
{ binary_op(v, v) } -> [same_as](concept.same#concept:same_as "18.4.2 Concept same_as [concept.same]")<vec<T, 1>>;
|
||
};
|
||
`
|
||
|
||
[11](#11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L16404)
|
||
|
||
Types BinaryOperation and T model[*reduction-binary-operation*](#concept:reduction-binary-operation "29.10.2.1 Exposition-only helpers [simd.expos.defn]")<BinaryOperation, T> only if:
|
||
|
||
- [(11.1)](#11.1)
|
||
|
||
BinaryOperation is a binary element-wise operation and the
|
||
operation is commutative[.](#11.1.sentence-1)
|
||
|
||
- [(11.2)](#11.2)
|
||
|
||
An object of type BinaryOperation can be invoked with two
|
||
arguments of type basic_vec<T, Abi>, with unspecified ABI tagAbi, returning a basic_vec<T, Abi>[.](#11.2.sentence-1)
|