Skip to content

Commit d54fa99

Browse files
Implement batch_bool::mask() for riscv
As a followup to #1236
1 parent 58bdc0a commit d54fa99

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/xsimd/arch/xsimd_rvv.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,16 @@ namespace xsimd
15071507
const auto mask = abs(arg) < constants::maxflint<batch<T, A>>();
15081508
return select(mask, to_float(detail::rvvfcvt_default(arg)), arg, rvv {});
15091509
}
1510+
1511+
// mask
1512+
template <class A, class T>
1513+
XSIMD_INLINE uint64_t mask(batch_bool<T, A> const& self, requires_arch<rvv>) noexcept
1514+
{
1515+
auto ones = detail::broadcast<as_unsigned_integer_t<T>, A::width>(1);
1516+
auto iota = detail::vindex<A, T>();
1517+
auto powers = detail::rvvsll(ones, iota);
1518+
return __riscv_vredor(self.data, powers);
1519+
}
15101520
} // namespace kernel
15111521
} // namespace xsimd
15121522

0 commit comments

Comments
 (0)