34template <
typename Type>
35struct SIMDRegister<Type>::ElementAccess
37 operator Type()
const {
return simd.get (idx); }
38 ElementAccess&
operator= (Type scalar)
noexcept { simd.
set (idx, scalar);
return *
this; }
43 ElementAccess (
SIMDRegister& owner,
size_t index) noexcept : simd (owner), idx (index) {}
54template <
typename Scalar>
57 using vSIMDType =
typename SIMDNativeOps<Scalar>::vSIMDType;
59 static inline vSIMDType JUCE_VECTOR_CALLTYPE load (
const Scalar* a)
noexcept
61 return SIMDNativeOps<Scalar>::load (a);
64 static inline void JUCE_VECTOR_CALLTYPE store (vSIMDType value, Scalar* dest)
noexcept
66 SIMDNativeOps<Scalar>::store (value, dest);
69 static inline vSIMDType JUCE_VECTOR_CALLTYPE expand (Scalar s)
noexcept
71 return SIMDNativeOps<Scalar>::expand (s);
74 static inline Scalar JUCE_VECTOR_CALLTYPE get (vSIMDType v, std::size_t i)
noexcept
76 return SIMDNativeOps<Scalar>::get (v, i);
79 static inline vSIMDType JUCE_VECTOR_CALLTYPE set (vSIMDType v, std::size_t i, Scalar s)
noexcept
81 return SIMDNativeOps<Scalar>::set (v, i, s);
84 static inline Scalar JUCE_VECTOR_CALLTYPE sum (vSIMDType a)
noexcept
86 return SIMDNativeOps<Scalar>::sum (a);
89 static inline vSIMDType JUCE_VECTOR_CALLTYPE mul (vSIMDType a, vSIMDType b)
noexcept
91 return SIMDNativeOps<Scalar>::mul (a, b);
94 static inline vSIMDType JUCE_VECTOR_CALLTYPE muladd (vSIMDType a, vSIMDType b, vSIMDType c)
noexcept
96 return SIMDNativeOps<Scalar>::multiplyAdd (a, b, c);
101template <
typename Scalar>
102struct CmplxSIMDOps<std::complex<Scalar>>
104 using vSIMDType =
typename SIMDNativeOps<Scalar>::vSIMDType;
106 static inline vSIMDType JUCE_VECTOR_CALLTYPE load (
const std::complex<Scalar>* a)
noexcept
108 return SIMDNativeOps<Scalar>::load (
reinterpret_cast<const Scalar*
> (a));
111 static inline void JUCE_VECTOR_CALLTYPE store (vSIMDType value, std::complex<Scalar>* dest)
noexcept
113 SIMDNativeOps<Scalar>::store (value,
reinterpret_cast<Scalar*
> (dest));
116 static inline vSIMDType JUCE_VECTOR_CALLTYPE expand (std::complex<Scalar> s)
noexcept
118 const int n =
sizeof (vSIMDType) /
sizeof (Scalar);
123 Scalar floats[(size_t) n];
126 for (
int i = 0; i < n; ++i)
127 u.floats[i] = (i & 1) == 0 ? s.real() : s.imag();
132 static inline std::complex<Scalar> JUCE_VECTOR_CALLTYPE get (vSIMDType v, std::size_t i)
noexcept
135 return std::complex<Scalar> (SIMDNativeOps<Scalar>::get (v, j), SIMDNativeOps<Scalar>::get (v, j + 1));
138 static inline vSIMDType JUCE_VECTOR_CALLTYPE set (vSIMDType v, std::size_t i, std::complex<Scalar> s)
noexcept
141 return SIMDNativeOps<Scalar>::set (SIMDNativeOps<Scalar>::set (v, j, s.real()), j + 1, s.imag());
144 static inline std::complex<Scalar> JUCE_VECTOR_CALLTYPE sum (vSIMDType a)
noexcept
146 vSIMDType result = SIMDNativeOps<Scalar>::oddevensum (a);
147 auto* ptr =
reinterpret_cast<const Scalar*
> (&result);
148 return std::complex<Scalar> (ptr[0], ptr[1]);
151 static inline vSIMDType JUCE_VECTOR_CALLTYPE mul (vSIMDType a, vSIMDType b)
noexcept
153 return SIMDNativeOps<Scalar>::cmplxmul (a, b);
156 static inline vSIMDType JUCE_VECTOR_CALLTYPE muladd (vSIMDType a, vSIMDType b, vSIMDType c)
noexcept
158 return SIMDNativeOps<Scalar>::add (a, SIMDNativeOps<Scalar>::cmplxmul (b, c));
166 template <
typename Type>
167 inline void snapToZero (SIMDRegister<Type>&)
noexcept {}
173template <
typename Type>
174inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE jmin (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) {
return dsp::SIMDRegister<Type>::min (a, b); }
175template <
typename Type>
176inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE jmax (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) {
return dsp::SIMDRegister<Type>::max (a, b); }
SIMDRegister &JUCE_VECTOR_CALLTYPE operator=(ElementType s) noexcept
static SIMDRegister JUCE_VECTOR_CALLTYPE max(SIMDRegister a, SIMDRegister b) noexcept
SIMDRegister() noexcept=default
static SIMDRegister JUCE_VECTOR_CALLTYPE min(SIMDRegister a, SIMDRegister b) noexcept
void JUCE_VECTOR_CALLTYPE set(size_t idx, ElementType v) noexcept