3#include "native/isa_import.h"
5#include <native/simd/math/exp.h>
6#include <native/simd/math/bits.h>
8#include "native/exp_policies.h"
20#define NATIVE_EMIT_WIDE_EXP(i,name) \
21 NATIVE_TARGET_PUSH(name) \
22 template<bool Flush=false,unsigned Degree=6,std::size_t L,std::size_t N,isa<> Arch> \
23 requires (Degree >= 1 && Degree <= 7) && (detail::exp_target<Arch> == i) && \
24 requires(std::array<simd<float,L,Arch>,N> const & x) { ::native::exp<Flush,Degree>(x); } \
25 native_nodiscard native_inline constexpr wide<simd<float,L,Arch>,N> \
26 exp(wide<simd<float,L,Arch>,N> const & input) \
27 noexcept(noexcept(wide<simd<float,L,Arch>,N>{::native::exp<Flush,Degree>(input.registers)})) { \
28 return wide<simd<float,L,Arch>,N>{::native::exp<Flush,Degree>(input.registers)}; \
31 NATIVE_EXP_TARGETS(NATIVE_EMIT_WIDE_EXP)
32#undef NATIVE_EMIT_WIDE_EXP
36export namespace math {
53 using ::math::damping_gain;
62 using ::math::flush_to_zero;
68 using ::math::round_even;
70export namespace wide {
72 using ::wide::constant_like;
78 using ::wide::bit_and;
80 using ::wide::bit_xor;
81 using ::wide::bit_not;
88 using ::wide::mask_not;
96 using ::wide::round_even;
100 using ::wide::select;
101 using ::wide::scaleb;
103 using ::wide::masked_scaleb;
105 using ::wide::masked_scaleb_zero;
107 using ::wide::from_bits;
109 using ::wide::mask_bits;
116 using ::wide::damping_gain;
124 using ::wide::sincos;
125 using ::wide::flush_to_zero;
constexpr simd< float, L, Arch > atan2(simd< float, L, Arch > y, simd< float, L, Arch > x) noexcept
constexpr simd< float, N, Arch > ceil(simd< float, N, Arch > x) noexcept
constexpr simd< float, L, Arch > exp2(simd< float, L, Arch > input) noexcept
constexpr auto abs(simd< float, N, Arch > a) noexcept
constexpr simd< float, N, Arch > trunc(simd< float, N, Arch > x) noexcept
constexpr simd< float, L, Arch > exp(simd< float, L, Arch > input) noexcept
Evaluate the binary32 range-reduced exponential approximation. Degree selects a polynomial from one t...
constexpr simd< float, N, Arch > floor(simd< float, N, Arch > x) noexcept
constexpr auto sincos(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &x) { detail::wide_generic_detail::adl_sincos(x);}) return noexcept(detail::wide_generic_detail::adl_sincos(std::declval< std::array< R, N > const & >())) &&std::is_nothrow_move_constructible_v< std::array< R, N > >;else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||(noexcept(detail::wide_generic_detail::adl_sincos(std::declval< R const & >())) &&noexcept(std::declval< R & >()=std::declval< decltype(detail::wide_generic_detail::adl_sincos(std::declval< R const & >())) & >().first) &&noexcept(std::declval< R & >()=std::declval< decltype(detail::wide_generic_detail::adl_sincos(std::declval< R const & >())) & >().second)));}())
constexpr wide< R, N > cos(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_cos(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_cos(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_cos(std::declval< R const & >())));}())
constexpr wide< R, N > tanh(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_tanh(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_tanh(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_tanh(std::declval< R const & >())));}())
constexpr wide< R, N > sin(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_sin(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_sin(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_sin(std::declval< R const & >())));}())
constexpr wide< R, N > log(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log(std::declval< R const & >())));}())
constexpr wide< R, N > log2(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log2(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log2(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log2(std::declval< R const & >())));}())
constexpr wide< R, N > damping_gain(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_damping_gain(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_damping_gain(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_damping_gain(std::declval< R const & >())));}())
constexpr wide< R, N > expm1(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_expm1(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_expm1(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_expm1(std::declval< R const & >())));}())
constexpr wide< R, N > log1p(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log1p(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log1p(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log1p(std::declval< R const & >())));}())
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
constexpr std::size_t sin_width
Suggested sine register count, matching the paired trigonometric kernel.
constexpr simd< T, N, A > sqrt(simd< T, N, A > v) noexcept
Compute correctly rounded square roots; negative finite lanes produce NaN.
constexpr std::size_t log_width
Conservative independent register count for the logarithm kernel.
constexpr std::size_t cos_width
Suggested cosine register count, matching the paired trigonometric kernel.
constexpr simd< fp16, 32, Arch > fma(simd< fp16, 32, Arch > a, simd< fp16, 32, Arch > b, simd< fp16, 32, Arch > c) noexcept
constexpr std::size_t log1p_width
Conservative independent register count for cancellation-safe log1p.
constexpr std::size_t damping_gain_width
Suggested damping_gain register count, matching its expm1 graph.
constexpr std::size_t atan2_width
constexpr std::size_t log2_width
Suggested log2 register count, matching the logarithm recommendation.
constexpr std::size_t exp2_width
Recommended exp2 register count; its shorter reduction favors small batches.
constexpr std::size_t expm1_width
Conservative independent register count for cancellation-safe expm1.
constexpr std::size_t tanh_width
Conservative independent register count for tanh's table and polynomial.
constexpr std::size_t exp_width
constexpr std::size_t sincos_width
Recommended independent register count for paired sine and cosine.