Files
2025-10-25 03:02:53 +03:00

10 KiB
Raw Permalink Blame History

[simd.permute.memory]

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.10 simd memory permute [simd.permute.memory]

🔗

template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr V unchecked_gather_from(R&& in, const I& indices, flags<Flags...> f = {}); template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr V unchecked_gather_from(R&& in, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {});

1

#

Let mask be typename I::mask_type(true) for the overload with no mask parameter.

2

#

Preconditions: All values in select(mask, indices, typename I::value_type()) are in the range [0, ranges::size(in)).

3

#

Effects: Equivalent to: return partial_gather_from(in, mask, indices, f);

4

#

Remarks: The default argument for template parameter V isvec<ranges::range_value_t, I::size()>.

🔗

template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr V partial_gather_from(R&& in, const I& indices, flags<Flags...> f = {}); template<class V = see below, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr V partial_gather_from(R&& in, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {});

5

#

Let:

mask be typename I::mask_type(true) for the overload with no mask parameter;

T be typename V::value_type.

6

#

Mandates:

ranges::range_value_t is a vectorizable type,

same_as<remove_cvref_t, V> is true,

V is an enabled specialization of basic_vec,

V::size() == I::size() is true, and

if the template parameter pack Flags does not containconvert-flag, then the conversion fromranges::range_value_t to T is value-preserving.

7

#

Preconditions:

  • (7.1)

    If the template parameter pack Flags containsaligned-flag, ranges::data(in) points to storage aligned byalignment_v<V, ranges::range_value_t>.

  • (7.2)

    If the template parameter pack Flags containsoveraligned-flag, ranges::data(in) points to storage aligned by N.

8

#

Returns: A basic_vec object where the ith element is initialized to the result ofmask[i] && indices[i] < ranges::size(in) ? static_cast(ranges::data(in)[indices[i]]) : T() for all i in the range [0, I::size()).

9

#

Remarks: The default argument for template parameter V isvec<ranges::range_value_t, I::size()>.

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr void unchecked_scatter_to(const V& v, R&& out, const I& indices, flags<Flags...> f = {}); template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr void unchecked_scatter_to(const V& v, R&& out, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {});

10

#

Let mask be typename I::mask_type(true) for the overload with no mask parameter.

11

#

Preconditions: All values in select(mask, indices, typename I::value_type()) are in the range [0, ranges::size(out)).

12

#

Effects: Equivalent to: partial_scatter_to(v, out, mask, indices, f);

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr void partial_scatter_to(const V& v, R&& out, const I& indices, flags<Flags...> f = {}); template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V, ranges::[contiguous_range](range.refinements#concept:contiguous_range "25.4.6Other range refinements[range.refinements]") R, [simd-integral](simd.expos#concept:simd-integral "29.10.2Exposition-only types, variables, and concepts[simd.expos]") I, class... Flags> requires ranges::[sized_range](range.sized#concept:sized_range "25.4.4Sized ranges[range.sized]")<R> constexpr void partial_scatter_to(const V& v, R&& out, const typename I::mask_type& mask, const I& indices, flags<Flags...> f = {});

13

#

Let mask be typename I::mask_type(true) for the overload with no mask parameter.

14

#

Constraints: V::size() == I::size() is true.

15

#

Mandates:

ranges::range_value_t is a vectorizable type, and

if the template parameter pack Flags does not contain convert-flag, then the conversion from typename V::value_type to ranges::range_value_t is value-preserving.

16

#

Preconditions:

  • (16.1)

    For all selected indices i the values indices[i] are unique.

  • (16.2)

    If the template parameter pack Flags contains aligned-flag,ranges::data(out) points to storage aligned byalignment_v<V, ranges::range_value_t>.

  • (16.3)

    If the template parameter pack Flags containsoveraligned-flag,ranges::data(out) points to storage aligned by N.

17

#

Effects: For all i in the range [0, I::size()), if mask[i] &&(indices[i] < ranges::size(out)) is true, evaluatesranges::data(out)[indices[i]] = v[i].