As far as I know, integers in C++ can be treated like booleans, and we can have a code like this:
int a = 6, b = 10;
if (a && b) do something ---> true as both a and b are non-zero
Now, assume that we have:
__m256i a, b;
I need to apply logical_and (&&) for all 4 long variables in __m256i, and return true if one pair is non-zero. I mean something like:
(a[0] && b[0]) || (a[1] && b[1]) || ...
Do we have a fast code in AVX or AVX2 for this purpose?
I could not find any direct instruction for this purpose, and definitely, using the bitwise and (&) also is not the same.