134 lines
4.0 KiB
Markdown
134 lines
4.0 KiB
Markdown
[simd.traits]
|
||
|
||
# 29 Numerics library [[numerics]](./#numerics)
|
||
|
||
## 29.10 Data-parallel types [[simd]](simd#traits)
|
||
|
||
### 29.10.4 Type traits [simd.traits]
|
||
|
||
[ð](#lib:alignment,simd)
|
||
|
||
`template<class T, class U = typename T::value_type> struct alignment { see below };
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17146)
|
||
|
||
alignment<T, U> has a member value if and only if
|
||
|
||
- [(1.1)](#1.1)
|
||
|
||
T is a specialization of basic_mask and U is bool, or
|
||
|
||
- [(1.2)](#1.2)
|
||
|
||
T is a specialization of basic_vec and U is a
|
||
vectorizable type[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17157)
|
||
|
||
If value is present, the type alignment<T, U> is aBinaryTypeTrait with a base characteristic ofintegral_constant<size_t, N> for some unspecifiedN ([[simd.ctor]](simd.ctor "29.10.7.2 basic_vec constructors"), [[simd.loadstore]](simd.loadstore "29.10.8.6 basic_vec load and store functions"))[.](#2.sentence-1)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
value identifies the alignment restrictions on pointers used for
|
||
(converting) loads and stores for the given type T on arrays of typeU[.](#2.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17168)
|
||
|
||
The behavior of a program that adds specializations for alignment is undefined[.](#3.sentence-1)
|
||
|
||
[ð](#lib:rebind,simd)
|
||
|
||
`template<class T, class V> struct rebind { using type = see below; };
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17179)
|
||
|
||
The member type is present if and only if
|
||
|
||
- [(4.1)](#4.1)
|
||
|
||
V is a data-parallel type,
|
||
|
||
- [(4.2)](#4.2)
|
||
|
||
T is a vectorizable type, and
|
||
|
||
- [(4.3)](#4.3)
|
||
|
||
*deduce-abi-t*<T, V::size()> has a member type type[.](#4.sentence-1)
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17188)
|
||
|
||
If V is a specialization of basic_vec, let Abi1 denote
|
||
an ABI tag such that basic_vec<T, Abi1>::size() equalsV::size()[.](#5.sentence-1)
|
||
|
||
If V is a specialization of basic_mask, let Abi1 denote an ABI tag such that basic_mask<sizeof(T),
|
||
Abi1>::size() equals V::size()[.](#5.sentence-2)
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17196)
|
||
|
||
Where present, the member typedef type names basic_vec<T, Abi1> if V is a specialization of basic_vec orbasic_mask<sizeof(T), Abi1> if V is a specialization ofbasic_mask[.](#6.sentence-1)
|
||
|
||
[ð](#lib:resize,simd)
|
||
|
||
`template<simd-size-type N, class V> struct resize { using type = see below; };
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17209)
|
||
|
||
Let T denote
|
||
|
||
- [(7.1)](#7.1)
|
||
|
||
typename V::value_type if V is a specialization of basic_vec,
|
||
|
||
- [(7.2)](#7.2)
|
||
|
||
otherwise *integer-from*<*mask-element-size*<V>> if V is a specialization of basic_mask[.](#7.sentence-1)
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17220)
|
||
|
||
The member type is present if and only if
|
||
|
||
- [(8.1)](#8.1)
|
||
|
||
V is a data-parallel type, and
|
||
|
||
- [(8.2)](#8.2)
|
||
|
||
*deduce-abi-t*<T, N> has a member type type[.](#8.sentence-1)
|
||
|
||
[9](#9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17227)
|
||
|
||
If V is a specialization of basic_vec, let Abi1 denote an
|
||
ABI tag such that basic_vec<T, Abi1>::size() equals N[.](#9.sentence-1)
|
||
|
||
If V is a specialization of basic_mask, let Abi1 denote an ABI tag such that basic_mask<sizeof(T), Abi1>::size() equals N[.](#9.sentence-2)
|
||
|
||
[10](#10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L17233)
|
||
|
||
Where present, the member typedef type names basic_vec<T, Abi1> if V is a specialization of basic_vec orbasic_mask<sizeof(T), Abi1> if V is a specialization ofbasic_mask[.](#10.sentence-1)
|