JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
SIMDMath.h File Reference
#include "JPLSpatial/Core.h"
#include "JPLSpatial/Math/SIMD.h"
#include <numbers>
#include <concepts>

Go to the source code of this file.

Namespaces

namespace  JPL
 
namespace  JPL::constant
 Log10 constants.
 
namespace  JPL::cephes
 Log constants.
 
namespace  JPL::logarithm
 
namespace  JPL::exponent
 
namespace  JPL::power
 
namespace  JPL::sincos
 
namespace  JPL::Math
 
namespace  JPL::tangent
 
namespace  JPL::asinacos
 
namespace  JPL::arctangent2
 

Macros

#define JPL_FL_CONSTANT(Name, Val)    JPL_INLINE simd c_##Name() noexcept { return simd(Val);; }
 Declare some SIMD constants.
 
#define JPL_INT_CONSTANT(Name, Val)    JPL_INLINE simd_mask c_i##Name() noexcept { return simd_mask(static_cast<uint32>(Val)); }
 
#define JPL_MASK_CONSTANT(Name, Val)    JPL_INLINE simd_mask c_##Name() noexcept { return simd_mask(static_cast<uint32>(Val)); }
 

Functions

JPL_INLINE constexpr auto JPL::FloorToSIMDSize (std::unsigned_integral auto count) noexcept
 Floor count to 4-wide simd vector.
 
JPL_INLINE constexpr auto JPL::FloorToSIMDSizeDouble (std::unsigned_integral auto count) noexcept
 Floor count to 8-wide simd vector.
 
JPL_INLINE constexpr auto JPL::GetSIMDTail (std::unsigned_integral auto count) noexcept
 Get the remaining tail from count that won't fill a simd vector.
 
JPL_INLINE constexpr auto JPL::GetNumSIMDOps (std::unsigned_integral auto count) noexcept
 Get number of SIMD operations that can fit into the count
 
JPL_INLINE constexpr auto JPL::GetNumSIMDOpsDouble (std::unsigned_integral auto count) noexcept
 Get number of 8-wide simd operations that can fit into the count
 
JPL_INLINE constexpr auto JPL::GetSIMDTailDouble (std::unsigned_integral auto count) noexcept
 Get the remaining tail from count that won't fill 8-wide simd vector.
 
JPL_INLINE constexpr auto JPL::RoundUpToSIMD (std::unsigned_integral auto count) noexcept
 Round count up to the next simd width.
 
JPL_INLINE constexpr auto JPL::FloorToDiv2 (std::unsigned_integral auto count) noexcept
 Floor count to divisible by 2.
 
JPL_INLINE constexpr auto JPL::GetDiv2Tail (std::unsigned_integral auto count) noexcept
 
 JPL::constant::JPL_MASK_CONSTANT (min_norm_pos, 0x00800000)
 
 JPL::constant::JPL_MASK_CONSTANT (mant_mask, 0x7f800000)
 
 JPL::constant::JPL_MASK_CONSTANT (inv_mant_mask, ~0x7f800000)
 
 JPL::constant::JPL_MASK_CONSTANT (sign_mask, 0x80000000)
 
 JPL::constant::JPL_MASK_CONSTANT (inv_sign_mask, ~0x80000000)
 
 JPL::constant::JPL_INT_CONSTANT (1, 1)
 
 JPL::constant::JPL_INT_CONSTANT (inv1, ~1)
 
 JPL::constant::JPL_INT_CONSTANT (2, 2)
 
 JPL::constant::JPL_INT_CONSTANT (4, 4)
 
 JPL::constant::JPL_INT_CONSTANT (0x7f, 0x7f)
 
 JPL::constant::JPL_FL_CONSTANT (pi, std::numbers::pi_v< float >)
 
 JPL::constant::JPL_FL_CONSTANT (half_pi, std::numbers::pi_v< float > *0.5f)
 
JPL_INLINE simd_mask JPL::signbit (const simd &vec) noexcept
 Equivalent to std::signbit but for 4-wide 32-bit float vector.
 
JPL_INLINE simd_mask JPL::isinf (const simd &vec) noexcept
 Determines if the given floating-point number num is a positive or negative infinity.
 
JPL_INLINE simd_mask JPL::isnan (const simd &vec) noexcept
 Determines if the given floating point number vec is a not-a-number(NaN) value.
 
JPL_INLINE simd JPL::trunc (const simd &vec) noexcept
 Computes the nearest integer not greater in magnitude than vec.
 
 JPL::cephes::JPL_FL_CONSTANT (SQRTHF, 0.707106781186547524f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p0, 7.0376836292e-2f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p1, -1.1514610310e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p2, 1.1676998740e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p3, -1.2420140846e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p4,+1.4249322787e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p5, -1.6668057665e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p6,+2.0000714765e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p7, -2.4999993993e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_p8,+3.3333331174e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_q1, -2.12194440e-4f)
 
 JPL::cephes::JPL_FL_CONSTANT (log_q2, 0.693359375f)
 
JPL_INLINE simd JPL::logarithm::polynomial (const simd &x) noexcept
 
simd JPL::log (simd x) noexcept
 
 JPL::constant::JPL_FL_CONSTANT (ln10, 2.3025850930f)
 
 JPL::constant::JPL_FL_CONSTANT (inv_ln10, 0.4342944819f)
 
 JPL::constant::JPL_FL_CONSTANT (ln2, 0.69314718056f)
 
 JPL::constant::JPL_FL_CONSTANT (inv_ln2, 1.4426950216f)
 
 JPL::constant::JPL_FL_CONSTANT (ln10div20, 0.11512925465f)
 
JPL_INLINE simd JPL::log10 (const simd &vec) noexcept
 log10 for 4-wide 32-bit float vector
 
JPL_INLINE simd JPL::log2 (const simd &vec) noexcept
 log2 for 4-wide 32-bit float vector
 
 JPL::constant::JPL_FL_CONSTANT (exp_hi, 88.3762626647949f)
 
 JPL::constant::JPL_FL_CONSTANT (exp_lo, -88.3762626647949f)
 
 JPL::cephes::JPL_FL_CONSTANT (LOG2EF, 1.44269504088896341f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_C1, 0.693359375f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_C2, -2.12194440e-4f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p0, 1.9875691500e-4f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p1, 1.3981999507e-3f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p2, 8.3334519073e-3f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p3, 4.1665795894e-2f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p4, 1.6666665459e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (exp_p5, 5.0000001201e-1f)
 
JPL_INLINE simd JPL::exponent::polynomial (const simd &x) noexcept
 
JPL_INLINE simd JPL::exponent::build2pown (const simd &n)
 
simd JPL::exp (simd x) noexcept
 Exponent for 4-wide 32-bit float vector.
 
JPL_INLINE simd JPL::exp2 (simd x) noexcept
 
JPL_INLINE simd JPL::ldexp (simd arg, simd_mask exp) noexcept
 Multiplies a floating-point value arg by the number 2 raised to the exp power.
 
JPL_INLINE simd JPL::power::mulsign (const simd &x, const simd &y) noexcept
 
JPL_INLINE simd JPL::power::sign (const simd &x) noexcept
 
simd JPL::pow (const simd &x, const simd &y) noexcept
 
 JPL::cephes::JPL_FL_CONSTANT (minus_DP1, -0.78515625f)
 
 JPL::cephes::JPL_FL_CONSTANT (minus_DP2, -2.4187564849853515625e-4f)
 
 JPL::cephes::JPL_FL_CONSTANT (minus_DP3, -3.77489497744594108e-8f)
 
 JPL::cephes::JPL_FL_CONSTANT (sincof_p0, -1.9515295891e-4f)
 
 JPL::cephes::JPL_FL_CONSTANT (sincof_p1, 8.3321608736e-3f)
 
 JPL::cephes::JPL_FL_CONSTANT (sincof_p2, -1.6666654611e-1f)
 
 JPL::cephes::JPL_FL_CONSTANT (coscof_p0, 2.443315711809948e-5f)
 
 JPL::cephes::JPL_FL_CONSTANT (coscof_p1, -1.388731625493765e-3f)
 
 JPL::cephes::JPL_FL_CONSTANT (coscof_p2, 4.166664568298827e-2f)
 
 JPL::cephes::JPL_FL_CONSTANT (FOPI, 1.27323954473516f)
 
JPL_INLINE void JPL::sincos::polynomials (const simd &x, simd &outTaylorCos, simd &outTaylorSin) noexcept
 
void JPL::Math::SinCos (simd x, simd &outSin, simd &outCos) noexcept
 Sin and Cos for 4-wide 32-bit float vector.
 
simd JPL::sin (simd x) noexcept
 
simd JPL::cos (simd x) noexcept
 
 JPL::constant::JPL_FL_CONSTANT (invPIO2, 0.63661977236758134308f)
 
 JPL::tangent::JPL_FL_CONSTANT (minus_DP1, -1.5703125f)
 
 JPL::tangent::JPL_FL_CONSTANT (minus_DP2, -0.0004837512969970703125f)
 
 JPL::tangent::JPL_FL_CONSTANT (minus_DP3, -7.549789948768648e-8f)
 
JPL_INLINE simd JPL::tangent::polynomial (simd x)
 
simd JPL::tan (simd x) noexcept
 
JPL_INLINE simd JPL::asinacos::polynomial (const simd &x, const simd &x2)
 
simd JPL::asin (const simd &in)
 
simd JPL::acos (const simd &in)
 
simd JPL::arctangent2::polynomial (simd x)
 
simd JPL::atan2 (const simd &y, const simd &x)
 

Macro Definition Documentation

◆ JPL_FL_CONSTANT

#define JPL_FL_CONSTANT (   Name,
  Val 
)     JPL_INLINE simd c_##Name() noexcept { return simd(Val);; }

Declare some SIMD constants.

◆ JPL_INT_CONSTANT

#define JPL_INT_CONSTANT (   Name,
  Val 
)     JPL_INLINE simd_mask c_i##Name() noexcept { return simd_mask(static_cast<uint32>(Val)); }

◆ JPL_MASK_CONSTANT

#define JPL_MASK_CONSTANT (   Name,
  Val 
)     JPL_INLINE simd_mask c_##Name() noexcept { return simd_mask(static_cast<uint32>(Val)); }