T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
Comparisons

Description

Functions for comparing elements of Vec's.

See also
Masked Comparisons

Functions

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpeq (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for equality ( == ).
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpge (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for greater-than-or-equal ( >= ).
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpgt (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for greater-than ( > ).
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmple (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for less-than-or-equal ( <= ).
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmplt (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for less-than ( < ).
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpneq (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Compares corresponding elements of two Vec's for inequality ( != ).
 
template<typename Tcond , typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::ifelse (const Vec< Tcond, SIMD_WIDTH > &cond, const Vec< T, SIMD_WIDTH > &trueVal, const Vec< T, SIMD_WIDTH > &falseVal)
 Selects elements from two Vec's based on a condition Vec.
 
template<typename T , size_t SIMD_WIDTH>
static bool simd::test_all_ones (const Vec< T, SIMD_WIDTH > &a)
 Tests if all bits of a Vec are one.
 
template<typename T , size_t SIMD_WIDTH>
static bool simd::test_all_zeros (const Vec< T, SIMD_WIDTH > &a)
 Tests if all bits of a Vec are zero.
 

Function Documentation

◆ cmpeq()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpeq ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for equality ( == ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmpeq(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmpeq(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ cmpge()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpge ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for greater-than-or-equal ( >= ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmpge(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmpge(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ cmpgt()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpgt ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for greater-than ( > ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmpgt(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmpgt(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ cmple()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmple ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for less-than-or-equal ( <= ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmple(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmple(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ cmplt()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmplt ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for less-than ( < ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmplt(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmplt(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ cmpneq()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::cmpneq ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Compares corresponding elements of two Vec's for inequality ( != ).

Parameters
afirst Vec to compare
bsecond Vec to compare
Returns
Vec containing the results of the comparison, where each element is all 1 bits or all 0 bits, depending on whether the corresponding comparison returned true or false, respectively
See also
mask_cmpne(const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)
mask_cmpne(const Mask<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &, const Vec<T, SIMD_WIDTH> &)

◆ ifelse()

template<typename Tcond , typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::ifelse ( const Vec< Tcond, SIMD_WIDTH > & cond,
const Vec< T, SIMD_WIDTH > & trueVal,
const Vec< T, SIMD_WIDTH > & falseVal )
inlinestatic

Selects elements from two Vec's based on a condition Vec.

The element type of the condition Vec must have the same size as the element type of the true and false value Vec's.

Parameters
condcondition Vec, each element must be either all 1 bits or all 0 bits, representing true or false, respectively
trueValVec to select from if the condition is true
falseValVec to select from if the condition is false
Returns
Vec containing the selected elements

◆ test_all_ones()

template<typename T , size_t SIMD_WIDTH>
static bool simd::test_all_ones ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Tests if all bits of a Vec are one.

Parameters
aVec to test
Returns
true if all bits are one, false otherwise

◆ test_all_zeros()

template<typename T , size_t SIMD_WIDTH>
static bool simd::test_all_zeros ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Tests if all bits of a Vec are zero.

Parameters
aVec to test
Returns
true if all bits are zero, false otherwise