38 template <
typename Scalar>
66 template <
typename Type>
78 using MaskType =
typename SIMDInternal::MaskTypeFor<ElementType>::type;
84 using PrimitiveType =
typename SIMDInternal::PrimitiveType<ElementType>::type;
144 return {CmplxOps::load (a)};
151 CmplxOps::store (value, a);
157 inline ElementType JUCE_VECTOR_CALLTYPE
get (
size_t idx)
const noexcept
159 jassert (idx < SIMDNumElements);
160 return CmplxOps::get (value, idx);
165 inline void JUCE_VECTOR_CALLTYPE
set (
size_t idx,
ElementType v) noexcept
167 jassert (idx < SIMDNumElements);
168 value = CmplxOps::set (value, idx, v);
183 jassert (idx < SIMDNumElements);
275 inline bool JUCE_VECTOR_CALLTYPE
operator== (
SIMDRegister other)
const noexcept {
return NativeOps::allEqual (value, other.value); }
284 inline bool JUCE_VECTOR_CALLTYPE
operator!= (Type s)
const noexcept {
return ! (*
this == s); }
328 return { CmplxOps::muladd (a.value, b.value, c.value) };
351 uintptr_t bitmask = SIMDRegisterSize - 1;
352 return (reinterpret_cast<uintptr_t> (ptr) & bitmask) == 0;
362 return snapPointerToAlignment (ptr, SIMDRegisterSize);
398 u.in = CmplxSIMDOps<MaskType>::expand (a);
407 #include "juce_SIMDRegister_Impl.h" static constexpr size_t size() noexcept
Returns the number of elements in this vector.
SIMDRegister JUCE_VECTOR_CALLTYPE operator &(vMaskType v) const noexcept
Returns the bit-and of the receiver and v.
static bool isSIMDAligned(const ElementType *ptr) noexcept
Checks if the given pointer is sufficiently aligned for using SIMD operations.
static vMaskType JUCE_VECTOR_CALLTYPE greaterThanOrEqual(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
typename SIMDInternal::MaskTypeFor< ElementType >::type MaskType
The corresponding primitive integer type, for example, this will be int32_t if type is a float...
static SIMDRegister JUCE_VECTOR_CALLTYPE abs(SIMDRegister a) noexcept
Returns the absolute value of each element.
static vMaskType JUCE_VECTOR_CALLTYPE lessThan(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
SIMDRegister &JUCE_VECTOR_CALLTYPE operator &=(vMaskType v) noexcept
Bit-and the receiver with SIMDRegister v and store the result in the receiver.
typename SIMDInternal::PrimitiveType< ElementType >::type PrimitiveType
The native primitive type (used internally).
bool JUCE_VECTOR_CALLTYPE operator!=(SIMDRegister other) const noexcept
Returns true if any element-wise comparisons return false.
ElementType sum() const noexcept
Returns a scalar which is the sum of all elements of the receiver.
static SIMDRegister JUCE_VECTOR_CALLTYPE min(SIMDRegister a, SIMDRegister b) noexcept
Returns a new vector where each element is the minimum of the corresponding element of a and b...
typename vMaskType::vSIMDType vMaskSIMDType
The internal native type for the corresponding mask type (used internally).
SIMDRegister &JUCE_VECTOR_CALLTYPE operator-=(SIMDRegister v) noexcept
Subtracts another SIMDRegister to the receiver.
static SIMDRegister JUCE_VECTOR_CALLTYPE truncate(SIMDRegister a) noexcept
Truncates each element to its integer part.
SIMDRegister JUCE_VECTOR_CALLTYPE operator|(vMaskType v) const noexcept
Returns the bit-or of the receiver and v.
A wrapper around the platform's native SIMD register type.
static SIMDRegister JUCE_VECTOR_CALLTYPE multiplyAdd(SIMDRegister a, const SIMDRegister b, SIMDRegister c) noexcept
Multiplies b and c and adds the result to a.
SIMDRegister &JUCE_VECTOR_CALLTYPE operator*=(SIMDRegister v) noexcept
Multiplies another SIMDRegister to the receiver.
static SIMDRegister JUCE_VECTOR_CALLTYPE expand(ElementType s) noexcept
Creates a new SIMDRegister from the corresponding scalar primitive.
~SIMDRegister() noexcept=default
Destructor.
static vMaskType JUCE_VECTOR_CALLTYPE notEqual(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
SIMDRegister() noexcept=default
Default constructor.
static SIMDRegister JUCE_VECTOR_CALLTYPE fromNative(vSIMDType a) noexcept
Creates a new SIMDRegister from the internal SIMD type (for example __mm128 for single-precision floa...
static vMaskType JUCE_VECTOR_CALLTYPE greaterThan(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
ElementType value_type
STL compatible value_type definition (same as ElementType).
SIMDRegister JUCE_VECTOR_CALLTYPE operator*(SIMDRegister v) const noexcept
Returns the product of the receiver and v.
void JUCE_VECTOR_CALLTYPE copyToRawArray(ElementType *a) const noexcept
Copies the elements of the SIMDRegister to a scalar array in memory.
SIMDRegister &JUCE_VECTOR_CALLTYPE operator^=(vMaskType v) noexcept
Bit-xor the receiver with SIMDRegister v and store the result in the receiver.
bool JUCE_VECTOR_CALLTYPE operator==(SIMDRegister other) const noexcept
Returns true if all element-wise comparisons return true.
static SIMDRegister JUCE_VECTOR_CALLTYPE fromRawArray(const ElementType *a) noexcept
Creates a new SIMDRegister from the first SIMDNumElements of a scalar array.
static constexpr size_t SIMDNumElements
The number of elements that this vector can hold.
Type ElementType
The type that represents the individual constituents of the SIMD Register.
SIMDRegister JUCE_VECTOR_CALLTYPE operator-(SIMDRegister v) const noexcept
Returns the difference of the receiver and v.
static vMaskType JUCE_VECTOR_CALLTYPE equal(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
static ElementType * getNextSIMDAlignedPtr(ElementType *ptr) noexcept
Returns the next position in memory where isSIMDAligned returns true.
static constexpr size_t SIMDRegisterSize
The size in bytes of this register.
SIMDRegister(Type s) noexcept
Constructs an object from a scalar type by broadcasting it to all elements.
SIMDRegister &JUCE_VECTOR_CALLTYPE operator|=(vMaskType v) noexcept
Bit-or the receiver with SIMDRegister v and store the result in the receiver.
SIMDRegister &JUCE_VECTOR_CALLTYPE operator=(ElementType s) noexcept
Broadcasts the scalar to all elements of the receiver.
static vMaskType JUCE_VECTOR_CALLTYPE lessThanOrEqual(SIMDRegister a, SIMDRegister b) noexcept
Returns a SIMDRegister of the corresponding integral type where each element has each bit set if the ...
ElementType JUCE_VECTOR_CALLTYPE operator[](size_t idx) const noexcept
Returns the idx-th element of the receiver.
SIMDNativeOps< PrimitiveType > NativeOps
The native operations for this platform and type combination (used internally)
typename NativeOps::vSIMDType vSIMDType
The native type (used internally).
SIMDRegister JUCE_VECTOR_CALLTYPE operator~() const noexcept
Returns a vector where each element is the bit-inverted value of the corresponding element in the rec...
CmplxSIMDOps< ElementType > CmplxOps
Wrapper for operations which need to be handled differently for complex and scalar types (used intern...
SIMDRegister JUCE_VECTOR_CALLTYPE operator+(SIMDRegister v) const noexcept
Returns the sum of the receiver and v.
SIMDRegister JUCE_VECTOR_CALLTYPE operator^(vMaskType v) const noexcept
Returns the bit-xor of the receiver and v.
SIMDRegister &JUCE_VECTOR_CALLTYPE operator+=(SIMDRegister v) noexcept
Adds another SIMDRegister to the receiver.
static SIMDRegister JUCE_VECTOR_CALLTYPE max(SIMDRegister a, SIMDRegister b) noexcept
Returns a new vector where each element is the maximum of the corresponding element of a and b...