Functor operators like `std::less` and friends do not respect a mask.
A ComposedFunctor
requires a mask_v
value as input.
This mask is always passed to the contained functors of the ComposedFunctor
.
However, when computing the final return value of the ComposedFunctor
, the mask is handled differently depending on which operator is used to combine the results of the contained functors.
If the operator is &&
or ||
the mask is used. In other cases it is not.e.g.
Let's say we have a composed functor FC = f1 && f2
where functor f1 returns mask_v{1010}
and f2 returns mask_v{0010}
.
That means f1&&f2 == mask_v{0010}
.
The return value of the ComposedFunctor
would depend on the mask_v
that is passed to FC
FC(mask_v{1111}) = mask_v{0010}
, but FC(mask_v{1101}) = mask_v{0000}
And FC(mask_v{0000})
would short-circuit and completely avoid any invocation of f1
or f2
.
A very easy reproducer can be achieved with the new test added in !2742 (merged) by simply adding the following line to the end:
std::cout << comp_prepared( simd_t::mask_false() ) << std::endl;
This should IMHO also short circuit and essentially not perform the comparison, but it returns mask_v{0011}
cc @graven I think this actually is a bug or at least unexpected behavior.