I know how to test if an _m128i register is all zero with the _mm_test_all_zeros
intrinsic.
What is the AVX2 / __m256i version of this intrinsic? If one isn't available, what is the fastest way to test if all 256 bits in a SIMD register are zero?
The fastest is probably vptest
instruction.
// Return 1 if `x` is all zeros, otherwise 0
inline int test_all_zeros( __m256i x )
{
return _mm256_testz_si256( x, x );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With