Files
cppdraft_translate/cppdraft/simd/creation.md
2025-10-25 03:02:53 +03:00

4.3 KiB
Raw Blame History

[simd.creation]

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.11 basic_vec and basic_mask creation [simd.creation]

🔗

template<class T, class Abi> constexpr auto chunk(const basic_vec<typename T::value_type, Abi>& x) noexcept; template<class T, class Abi> constexpr auto chunk(const basic_mask<mask-element-size<T>, Abi>& x) noexcept;

1

#

Constraints:

  • (1.1)

    For the first overload, T is an enabled specialization of basic_vec. If basic_vec<typename T::value_type, Abi>::size() % T::size() is not 0, then resize_t<basic_vec<typename T::value_type, Abi>::size()% T::size(), T> is valid and denotes a type.

  • (1.2)

    For the second overload, T is an enabled specialization of basic_mask. If basic_mask<mask-element-size, Abi>::size() % T::size() is not 0, then resize_t<basic_mask<mask-element-size, Abi>::size() % T::size(), T> is valid and denotes a type.

2

#

Let N be x.size() / T::size().

3

#

Returns:

  • (3.1)

    If x.size() % T::size() == 0 is true, an array<T, N> with the ith basic_vec or basic_mask element of the jth array element initialized to the value of the element in x with index i + j * T::size().

  • (3.2)

    Otherwise, a tuple of N objects of type T and one object of type resize_t<x.size() % T::size(), T>. The ith basic_vec or basic_mask element of the jth tuple element of type T is initialized to the value of the element in x with index i + j * T::size(). The ith basic_vec or basic_mask element of the Nth tuple element is initialized to the value of the element in x with index i + N * T::size().

🔗

template<simd-size-type N, class T, class Abi> constexpr auto chunk(const basic_vec<T, Abi>& x) noexcept;

4

#

Effects: Equivalent to: return chunk<resize_t<N, basic_vec<T, Abi>>>(x);

🔗

template<simd-size-type N, size_t Bytes, class Abi> constexpr auto chunk(const basic_mask<Bytes, Abi>& x) noexcept;

5

#

Effects: Equivalent to: return chunk<resize_t<N, basic_mask<Bytes, Abi>>>(x);

🔗

template<class T, class... Abis> constexpr vec<T, (basic_vec<T, Abis>::size() + ...)> cat(const basic_vec<T, Abis>&... xs) noexcept; template<size_t Bytes, class... Abis> constexpr basic_mask<Bytes, deduce-abi-t<integer-from<Bytes>, (basic_mask<Bytes, Abis>::size() + ...)>> cat(const basic_mask<Bytes, Abis>&... xs) noexcept;

6

#

Constraints:

  • (6.1)

    For the first overload vec<T, (basic_vec<T, Abis>::size() + ...)> is enabled.

  • (6.2)

    For the second overload basic_mask<Bytes, deduce-abi-t<integer-from, (basic_mask<Bytes, Abis>::size() + ...)>> is enabled.

7

#

Returns: A data-parallel object initialized with the concatenated values in thexs pack of data-parallel objects: The ithbasic_vec/basic_mask element of the jth parameter in the xs pack is copied to the return value's element with index i + the sum of the width of the first j parameters in the xs pack.