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