29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.3 Header <simd> synopsis [simd.syn]

namespace std { // [simd.traits], simd type traits template<class T, class U = typename T::value_type> struct simd_alignment; template<class T, class U = typename T::value_type> constexpr size_t simd_alignment_v = simd_alignment<T, U>::value; template<class T, class V> struct rebind_simd { using type = see below; }; template<class T, class V> using rebind_simd_t = typename rebind_simd<T, V>::type; template<simd-size-type N, class V> struct resize_simd { using type = see below; }; template<simd-size-type N, class V> using resize_simd_t = typename resize_simd<N, V>::type; // [simd.flags], Load and store flags template<class... Flags> struct simd_flags; inline constexpr simd_flags<> simd_flag_default{}; inline constexpr simd_flags<convert-flag> simd_flag_convert{}; inline constexpr simd_flags<aligned-flag> simd_flag_aligned{}; template<size_t N> requires (has_single_bit(N)) constexpr simd_flags<overaligned-flag<N>> simd_flag_overaligned{}; // [simd.class], Class template basic_simd template<class T, class Abi = native-abi<T>> class basic_simd; template<class T, simd-size-type N = simd-size-v<T, native-abi<T>>> using simd = basic_simd<T, deduce-abi-t<T, N>>; // [simd.mask.class], Class template basic_simd_mask template<size_t Bytes, class Abi = native-abi<integer-from<Bytes>>> class basic_simd_mask; template<class T, simd-size-type N = simd-size-v<T, native-abi<T>>> using simd_mask = basic_simd_mask<sizeof(T), deduce-abi-t<T, N>>; // [simd.loadstore], basic_simd load and store functions template<class V = see below, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> constexpr V simd_unchecked_load(R&& r, simd_flags<Flags...> f = {}); template<class V = see below, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> constexpr V simd_unchecked_load(R&& r, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, class... Flags> constexpr V simd_unchecked_load(I first, iter_difference_t<I> n, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, class... Flags> constexpr V simd_unchecked_load(I first, iter_difference_t<I> n, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> constexpr V simd_unchecked_load(I first, S last, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> constexpr V simd_unchecked_load(I first, S last, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class V = see below, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> constexpr V simd_partial_load(R&& r, simd_flags<Flags...> f = {}); template<class V = see below, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> constexpr V simd_partial_load(R&& r, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, class... Flags> constexpr V simd_partial_load(I first, iter_difference_t<I> n, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, class... Flags> constexpr V simd_partial_load(I first, iter_difference_t<I> n, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> constexpr V simd_partial_load(I first, S last, simd_flags<Flags...> f = {}); template<class V = see below, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> constexpr V simd_partial_load(I first, S last, const typename V::mask_type& k, simd_flags<Flags...> f = {}); template<class T, class Abi, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> && indirectly_writable<ranges::iterator_t<R>, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, R&& r, simd_flags<Flags...> f = {}); template<class T, class Abi, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> && indirectly_writable<ranges::iterator_t<R>, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, R&& r, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, class... Flags> requires indirectly_writable<I, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, I first, iter_difference_t<I> n, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, class... Flags> requires indirectly_writable<I, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, I first, iter_difference_t<I> n, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> requires indirectly_writable<I, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, I first, S last, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> requires indirectly_writable<I, T> constexpr void simd_unchecked_store(const basic_simd<T, Abi>& v, I first, S last, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); template<class T, class Abi, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> && indirectly_writable<ranges::iterator_t<R>, T> constexpr void simd_partial_store(const basic_simd<T, Abi>& v, R&& r, simd_flags<Flags...> f = {}); template<class T, class Abi, ranges::contiguous_range R, class... Flags> requires ranges::sized_range<R> && indirectly_writable<ranges::iterator_t<R>, T> constexpr void simd_partial_store(const basic_simd<T, Abi>& v, R&& r, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, class... Flags> requires indirectly_writable<I, T> constexpr void simd_partial_store( const basic_simd<T, Abi>& v, I first, iter_difference_t<I> n, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, class... Flags> requires indirectly_writable<I, T> constexpr void simd_partial_store( const basic_simd<T, Abi>& v, I first, iter_difference_t<I> n, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> requires indirectly_writable<I, T> constexpr void simd_partial_store(const basic_simd<T, Abi>& v, I first, S last, simd_flags<Flags...> f = {}); template<class T, class Abi, contiguous_iterator I, sized_sentinel_for<I> S, class... Flags> requires indirectly_writable<I, T> constexpr void simd_partial_store(const basic_simd<T, Abi>& v, I first, S last, const typename basic_simd<T, Abi>::mask_type& mask, simd_flags<Flags...> f = {}); // [simd.creation], basic_simd and basic_simd_mask creation template<class T, class Abi> constexpr auto simd_split(const basic_simd<typename T::value_type, Abi>& x) noexcept; template<class T, class Abi> constexpr auto simd_split(const basic_simd_mask<mask-element-size<T>, Abi>& x) noexcept; template<class T, class... Abis> constexpr basic_simd<T, deduce-abi-t<T, (basic_simd<T, Abis>::size() + ...)>> simd_cat(const basic_simd<T, Abis>&...) noexcept; template<size_t Bytes, class... Abis> constexpr basic_simd_mask<Bytes, deduce-abi-t<integer-from<Bytes>, (basic_simd_mask<Bytes, Abis>::size() + ...)>> simd_cat(const basic_simd_mask<Bytes, Abis>&...) noexcept; // [simd.mask.reductions], basic_simd_mask reductions template<size_t Bytes, class Abi> constexpr bool all_of(const basic_simd_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi> constexpr bool any_of(const basic_simd_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi> constexpr bool none_of(const basic_simd_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi> constexpr simd-size-type reduce_count(const basic_simd_mask<Bytes, Abi>&) noexcept; template<size_t Bytes, class Abi> constexpr simd-size-type reduce_min_index(const basic_simd_mask<Bytes, Abi>&); template<size_t Bytes, class Abi> constexpr simd-size-type reduce_max_index(const basic_simd_mask<Bytes, Abi>&); constexpr bool all_of(same_as<bool> auto) noexcept; constexpr bool any_of(same_as<bool> auto) noexcept; constexpr bool none_of(same_as<bool> auto) noexcept; constexpr simd-size-type reduce_count(same_as<bool> auto) noexcept; constexpr simd-size-type reduce_min_index(same_as<bool> auto); constexpr simd-size-type reduce_max_index(same_as<bool> auto); // [simd.reductions], basic_simd reductions template<class T, class Abi, class BinaryOperation = plus<>> constexpr T reduce(const basic_simd<T, Abi>&, BinaryOperation = {}); template<class T, class Abi, class BinaryOperation = plus<>> constexpr T reduce( const basic_simd<T, Abi>& x, const typename basic_simd<T, Abi>::mask_type& mask, BinaryOperation binary_op = {}, type_identity_t<T> identity_element = see below); template<class T, class Abi> constexpr T reduce_min(const basic_simd<T, Abi>&) noexcept; template<class T, class Abi> constexpr T reduce_min(const basic_simd<T, Abi>&, const typename basic_simd<T, Abi>::mask_type&) noexcept; template<class T, class Abi> constexpr T reduce_max(const basic_simd<T, Abi>&) noexcept; template<class T, class Abi> constexpr T reduce_max(const basic_simd<T, Abi>&, const typename basic_simd<T, Abi>::mask_type&) noexcept; // [simd.alg], Algorithms template<class T, class Abi> constexpr basic_simd<T, Abi> min(const basic_simd<T, Abi>& a, const basic_simd<T, Abi>& b) noexcept; template<class T, class Abi> constexpr basic_simd<T, Abi> max(const basic_simd<T, Abi>& a, const basic_simd<T, Abi>& b) noexcept; template<class T, class Abi> constexpr pair<basic_simd<T, Abi>, basic_simd<T, Abi>> minmax(const basic_simd<T, Abi>& a, const basic_simd<T, Abi>& b) noexcept; template<class T, class Abi> constexpr basic_simd<T, Abi> clamp(const basic_simd<T, Abi>& v, const basic_simd<T, Abi>& lo, const basic_simd<T, Abi>& hi); template<class T, class U> constexpr auto simd_select(bool c, const T& a, const U& b) -> remove_cvref_t<decltype(c ? a : b)>; template<size_t Bytes, class Abi, class T, class U> constexpr auto simd_select(const basic_simd_mask<Bytes, Abi>& c, const T& a, const U& b) noexcept -> decltype(simd-select-impl(c, a, b)); // [simd.math], Mathematical functions template<math-floating-point V> constexpr deduced-simd-t<V> acos(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> asin(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> atan(const V& x); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> atan2(const V0& y, const V1& x); template<math-floating-point V> constexpr deduced-simd-t<V> cos(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> sin(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> tan(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> acosh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> asinh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> atanh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> cosh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> sinh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> tanh(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> exp(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> exp2(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> expm1(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> frexp(const V& value, rebind_simd_t<int, deduced-simd-t<V>>* exp); template<math-floating-point V> constexpr rebind_simd_t<int, deduced-simd-t<V>> ilogb(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> ldexp(const V& x, const rebind_simd_t<int, deduced-simd-t<V>>& exp); template<math-floating-point V> constexpr deduced-simd-t<V> log(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> log10(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> log1p(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> log2(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> logb(const V& x); template<class T, class Abi> constexpr basic_simd<T, Abi> modf(const type_identity_t<basic_simd<T, Abi>>& value, basic_simd<T, Abi>* iptr); template<math-floating-point V> constexpr deduced-simd-t<V> scalbn(const V& x, const rebind_simd_t<int, deduced-simd-t<V>>& n); template<math-floating-point V> constexpr deduced-simd-t<V> scalbln( const V& x, const rebind_simd_t<long int, deduced-simd-t<V>>& n); template<math-floating-point V> constexpr deduced-simd-t<V> cbrt(const V& x); template<signed_integral T, class Abi> constexpr basic_simd<T, Abi> abs(const basic_simd<T, Abi>& j); template<math-floating-point V> constexpr deduced-simd-t<V> abs(const V& j); template<math-floating-point V> constexpr deduced-simd-t<V> fabs(const V& x); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> hypot(const V0& x, const V1& y); template<class V0, class V1, class V2> constexpr math-common-simd-t<V0, V1, V2> hypot(const V0& x, const V1& y, const V2& z); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> pow(const V0& x, const V1& y); template<math-floating-point V> constexpr deduced-simd-t<V> sqrt(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> erf(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> erfc(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> lgamma(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> tgamma(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> ceil(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> floor(const V& x); template<math-floating-point V> deduced-simd-t<V> nearbyint(const V& x); template<math-floating-point V> deduced-simd-t<V> rint(const V& x); template<math-floating-point V> rebind_simd_t<long int, deduced-simd-t<V>> lrint(const V& x); template<math-floating-point V> rebind_simd_t<long long int, V> llrint(const deduced-simd-t<V>& x); template<math-floating-point V> constexpr deduced-simd-t<V> round(const V& x); template<math-floating-point V> constexpr rebind_simd_t<long int, deduced-simd-t<V>> lround(const V& x); template<math-floating-point V> constexpr rebind_simd_t<long long int, deduced-simd-t<V>> llround(const V& x); template<math-floating-point V> constexpr deduced-simd-t<V> trunc(const V& x); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> fmod(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> remainder(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> remquo(const V0& x, const V1& y, rebind_simd_t<int, math-common-simd-t<V0, V1>>* quo); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> copysign(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> nextafter(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> fdim(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> fmax(const V0& x, const V1& y); template<class V0, class V1> constexpr math-common-simd-t<V0, V1> fmin(const V0& x, const V1& y); template<class V0, class V1, class V2> constexpr math-common-simd-t<V0, V1, V2> fma(const V0& x, const V1& y, const V2& z); template<class V0, class V1, class V2> constexpr math-common-simd-t<V0, V1, V2> lerp(const V0& a, const V1& b, const V2& t) noexcept; template<math-floating-point V> constexpr rebind_simd_t<int, deduced-simd-t<V>> fpclassify(const V& x); template<math-floating-point V> constexpr typename deduced-simd-t<V>::mask_type isfinite(const V& x); template<math-floating-point V> constexpr typename deduced-simd-t<V>::mask_type isinf(const V& x); template<math-floating-point V> constexpr typename deduced-simd-t<V>::mask_type isnan(const V& x); template<math-floating-point V> constexpr typename deduced-simd-t<V>::mask_type isnormal(const V& x); template<math-floating-point V> constexpr typename deduced-simd-t<V>::mask_type signbit(const V& x); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type isgreater(const V0& x, const V1& y); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type isgreaterequal(const V0& x, const V1& y); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type isless(const V0& x, const V1& y); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type islessequal(const V0& x, const V1& y); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type islessgreater(const V0& x, const V1& y); template<class V0, class V1> constexpr typename math-common-simd-t<V0, V1>::mask_type isunordered(const V0& x, const V1& y); template<math-floating-point V> deduced-simd-t<V> assoc_laguerre(const rebind_simd_t<unsigned, deduced-simd-t<V>>& n, const rebind_simd_t<unsigned, deduced-simd-t<V>>& m, const V& x); template<math-floating-point V> deduced-simd-t<V> assoc_legendre(const rebind_simd_t<unsigned, deduced-simd-t<V>>& l, const rebind_simd_t<unsigned, deduced-simd-t<V>>& m, const V& x); template<class V0, class V1> math-common-simd-t<V0, V1> beta(const V0& x, const V1& y); template<math-floating-point V> deduced-simd-t<V> comp_ellint_1(const V& k); template<math-floating-point V> deduced-simd-t<V> comp_ellint_2(const V& k); template<class V0, class V1> math-common-simd-t<V0, V1> comp_ellint_3(const V0& k, const V1& nu); template<class V0, class V1> math-common-simd-t<V0, V1> cyl_bessel_i(const V0& nu, const V1& x); template<class V0, class V1> math-common-simd-t<V0, V1> cyl_bessel_j(const V0& nu, const V1& x); template<class V0, class V1> math-common-simd-t<V0, V1> cyl_bessel_k(const V0& nu, const V1& x); template<class V0, class V1> math-common-simd-t<V0, V1> cyl_neumann(const V0& nu, const V1& x); template<class V0, class V1> math-common-simd-t<V0, V1> ellint_1(const V0& k, const V1& phi); template<class V0, class V1> math-common-simd-t<V0, V1> ellint_2(const V0& k, const V1& phi); template<class V0, class V1, class V2> math-common-simd-t<V0, V1, V2> ellint_3(const V0& k, const V1& nu, const V2& phi); template<math-floating-point V> deduced-simd-t<V> expint(const V& x); template<math-floating-point V> deduced-simd-t<V> hermite(const rebind_simd_t<unsigned, deduced-simd-t<V>>& n, const V& x); template<math-floating-point V> deduced-simd-t<V> laguerre(const rebind_simd_t<unsigned, deduced-simd-t<V>>& n, const V& x); template<math-floating-point V> deduced-simd-t<V> legendre(const rebind_simd_t<unsigned, deduced-simd-t<V>>& l, const V& x); template<math-floating-point V> deduced-simd-t<V> riemann_zeta(const V& x); template<math-floating-point V> deduced-simd-t<V> sph_bessel( const rebind_simd_t<unsigned, deduced-simd-t<V>>& n, const V& x); template<math-floating-point V> deduced-simd-t<V> sph_legendre(const rebind_simd_t<unsigned, deduced-simd-t<V>>& l, const rebind_simd_t<unsigned, deduced-simd-t<V>>& m, const V& theta); template<math-floating-point V> deduced-simd-t<V> sph_neumann(const rebind_simd_t<unsigned, deduced-simd-t<V>>& n, const V& x); }