Vital
|
Represents a vector of integer values using SIMD instructions. More...
#include <poly_values.h>
Classes | |
union | scalar_simd_union |
Helper union for copying between a scalar array and a SIMD type. More... | |
union | simd_scalar_union |
Helper union for copying between a SIMD type and a scalar array. More... | |
Public Member Functions | |
force_inline | poly_int () noexcept |
Default constructor. Initializes to zero. | |
force_inline | poly_int (simd_type initial_value) noexcept |
Constructs from a raw SIMD register. | |
force_inline | poly_int (uint32_t initial_value) noexcept |
Constructs the SIMD register by broadcasting a single integer value. | |
force_inline | poly_int (uint32_t first, uint32_t second, uint32_t third, uint32_t fourth) noexcept |
Constructs the SIMD register with four specified integers. | |
force_inline | poly_int (uint32_t first, uint32_t second) noexcept |
Constructs a 4-element SIMD register by repeating two values (for SSE2/NEON). | |
force_inline | ~poly_int () noexcept |
Destructor. | |
force_inline uint32_t vector_call | access (size_t index) const noexcept |
Accessor for an element in the SIMD register. | |
force_inline void vector_call | set (size_t index, uint32_t new_value) noexcept |
Sets a specific element in the SIMD register. | |
force_inline uint32_t vector_call | operator[] (size_t index) const noexcept |
Operator[] overload (read-only). | |
force_inline poly_int &vector_call | operator+= (poly_int other) noexcept |
Compound assignment operators using poly_int. | |
force_inline poly_int &vector_call | operator-= (poly_int other) noexcept |
force_inline poly_int &vector_call | operator*= (poly_int other) noexcept |
force_inline poly_int &vector_call | operator&= (poly_int other) noexcept |
force_inline poly_int &vector_call | operator|= (poly_int other) noexcept |
force_inline poly_int &vector_call | operator^= (poly_int other) noexcept |
force_inline poly_int &vector_call | operator+= (simd_type other) noexcept |
Compound assignment operators using simd_type. | |
force_inline poly_int &vector_call | operator-= (simd_type other) noexcept |
force_inline poly_int &vector_call | operator*= (simd_type other) noexcept |
force_inline poly_int &vector_call | operator&= (simd_type other) noexcept |
force_inline poly_int &vector_call | operator|= (simd_type other) noexcept |
force_inline poly_int &vector_call | operator^= (simd_type other) noexcept |
force_inline poly_int &vector_call | operator+= (uint32_t scalar) noexcept |
Compound assignment operators using a scalar. | |
force_inline poly_int &vector_call | operator-= (uint32_t scalar) noexcept |
force_inline poly_int &vector_call | operator*= (uint32_t scalar) noexcept |
force_inline poly_int vector_call | operator+ (poly_int other) const noexcept |
Arithmetic operators. | |
force_inline poly_int vector_call | operator- (poly_int other) const noexcept |
force_inline poly_int vector_call | operator* (poly_int other) const noexcept |
force_inline poly_int vector_call | operator& (poly_int other) const noexcept |
Bitwise operators. | |
force_inline poly_int vector_call | operator| (poly_int other) const noexcept |
force_inline poly_int vector_call | operator^ (poly_int other) const noexcept |
force_inline poly_int vector_call | operator- () const noexcept |
Unary operators. | |
force_inline poly_int vector_call | operator~ () const noexcept |
force_inline uint32_t vector_call | sum () const noexcept |
Sums all elements in the SIMD register. | |
force_inline uint32_t vector_call | anyMask () const noexcept |
Returns a bitmask for elements that are non-zero. | |
Static Public Member Functions | |
static force_inline simd_type vector_call | init (uint32_t scalar) |
Initializes a SIMD register with the same integer repeated. | |
static force_inline simd_type vector_call | load (const uint32_t *memory) |
Loads integer values from memory into a SIMD register. | |
static force_inline simd_type vector_call | add (simd_type one, simd_type two) |
Adds two SIMD integer registers. | |
static force_inline simd_type vector_call | sub (simd_type one, simd_type two) |
Subtracts one SIMD integer register from another. | |
static force_inline simd_type vector_call | neg (simd_type value) |
Negates a SIMD integer register. | |
static force_inline simd_type vector_call | mul (simd_type one, simd_type two) |
Multiplies two SIMD integer registers element-wise. | |
static force_inline simd_type vector_call | bitAnd (simd_type value, simd_type mask) |
Bitwise AND of a SIMD integer register with another. | |
static force_inline simd_type vector_call | bitOr (simd_type value, simd_type mask) |
Bitwise OR of a SIMD integer register with another. | |
static force_inline simd_type vector_call | bitXor (simd_type value, simd_type mask) |
Bitwise XOR of a SIMD integer register with another. | |
static force_inline simd_type vector_call | bitNot (simd_type value) |
Bitwise NOT of a SIMD integer register. | |
static force_inline simd_type vector_call | max (simd_type one, simd_type two) |
Returns the element-wise maximum of two SIMD integer registers. | |
static force_inline simd_type vector_call | min (simd_type one, simd_type two) |
Returns the element-wise minimum of two SIMD integer registers. | |
static force_inline simd_type vector_call | equal (simd_type one, simd_type two) |
Compares two SIMD integer registers for equality, element-wise. | |
static force_inline simd_type vector_call | greaterThan (simd_type one, simd_type two) |
Compares two SIMD integer registers, element-wise, for greater than. | |
static force_inline uint32_t vector_call | sum (simd_type value) |
Computes the sum of all elements in a SIMD integer register. | |
static force_inline uint32_t vector_call | anyMask (simd_type value) |
Returns a bitmask that indicates which bytes/elements in the register are non-zero. | |
static force_inline poly_int vector_call | max (poly_int one, poly_int two) |
Convenience overloads returning poly_int instead of simd_type: | |
static force_inline poly_int vector_call | min (poly_int one, poly_int two) |
static force_inline poly_int vector_call | equal (poly_int one, poly_int two) |
static force_inline poly_int vector_call | greaterThan (poly_int one, poly_int two) |
static force_inline poly_int vector_call | lessThan (poly_int one, poly_int two) |
static force_inline uint32_t vector_call | sum (poly_int value) |
Public Attributes | |
simd_type | value |
The underlying SIMD register. | |
Static Public Attributes | |
static constexpr uint32_t | kFullMask = (unsigned int)-1 |
All bits set. | |
static constexpr uint32_t | kSignMask = 0x80000000 |
Sign bit mask. | |
static constexpr uint32_t | kNotSignMask = kFullMask ^ kSignMask |
Inverted sign bit mask. | |
Represents a vector of integer values using SIMD instructions.
Depending on the available instruction set (AVX2, SSE2, NEON), the vector width differs. This struct provides basic arithmetic, bitwise, and comparison operations on these SIMD vectors.
|
inlinenoexcept |
Default constructor. Initializes to zero.
|
inlinenoexcept |
Constructs from a raw SIMD register.
initial_value | The SIMD register. |
|
inlinenoexcept |
Constructs the SIMD register by broadcasting a single integer value.
initial_value | The integer value to broadcast. |
|
inlinenoexcept |
Constructs the SIMD register with four specified integers.
first | The first element. |
second | The second element. |
third | The third element. |
fourth | The fourth element. |
|
inlinenoexcept |
Constructs a 4-element SIMD register by repeating two values (for SSE2/NEON).
first | The first element. |
second | The second element. |
|
inlinenoexcept |
Destructor.
|
inlinenoexcept |
Accessor for an element in the SIMD register.
index | The index (0-based) of the element. |
|
inlinestatic |
Adds two SIMD integer registers.
one | First operand. |
two | Second operand. |
|
inlinenoexcept |
Returns a bitmask for elements that are non-zero.
|
inlinestatic |
Returns a bitmask that indicates which bytes/elements in the register are non-zero.
value | The SIMD register to test. |
|
inlinestatic |
Bitwise AND of a SIMD integer register with another.
value | The operand to be masked. |
mask | The mask to apply. |
|
inlinestatic |
Bitwise NOT of a SIMD integer register.
value | The operand to be inverted. |
|
inlinestatic |
Bitwise OR of a SIMD integer register with another.
value | The operand to be combined. |
mask | The mask to apply. |
|
inlinestatic |
Bitwise XOR of a SIMD integer register with another.
value | The operand to be combined. |
mask | The mask to apply. |
|
inlinestatic |
|
inlinestatic |
Compares two SIMD integer registers for equality, element-wise.
one | First operand. |
two | Second operand. |
|
inlinestatic |
|
inlinestatic |
Compares two SIMD integer registers, element-wise, for greater than.
one | First operand. |
two | Second operand. |
Note: For SSE2/AVX2, we handle sign by flipping the sign bit.
|
inlinestatic |
Initializes a SIMD register with the same integer repeated.
scalar | Integer value to broadcast across the SIMD register. |
|
inlinestatic |
|
inlinestatic |
Loads integer values from memory into a SIMD register.
memory | Pointer to memory location where integer data is stored. |
|
inlinestatic |
Convenience overloads returning poly_int instead of simd_type:
|
inlinestatic |
Returns the element-wise maximum of two SIMD integer registers.
one | First operand. |
two | Second operand. |
|
inlinestatic |
|
inlinestatic |
Returns the element-wise minimum of two SIMD integer registers.
one | First operand. |
two | Second operand. |
|
inlinestatic |
Multiplies two SIMD integer registers element-wise.
one | First operand. |
two | Second operand. |
|
inlinestatic |
Negates a SIMD integer register.
value | SIMD register to negate. |
|
inlinenoexcept |
Bitwise operators.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Arithmetic operators.
|
inlinenoexcept |
Compound assignment operators using poly_int.
|
inlinenoexcept |
Compound assignment operators using simd_type.
|
inlinenoexcept |
Compound assignment operators using a scalar.
|
inlinenoexcept |
Unary operators.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Operator[] overload (read-only).
index | The index to access. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Sets a specific element in the SIMD register.
index | The index (0-based) of the element. |
new_value | The new value to place at that index. |
|
inlinestatic |
Subtracts one SIMD integer register from another.
one | First operand. |
two | Second operand. |
one - two
.
|
inlinenoexcept |
Sums all elements in the SIMD register.
|
inlinestatic |
|
inlinestatic |
Computes the sum of all elements in a SIMD integer register.
value | The SIMD register. |
|
staticconstexpr |
All bits set.
Inverted sign bit mask.
|
staticconstexpr |
Sign bit mask.
simd_type vital::poly_int::value |
The underlying SIMD register.