commit 614f81271ede9d60093e36f868321b0e5254ac40
parent 9229319dc8963a0157f970563de952911ea9c228
Author: [email protected] <[email protected]>
Date: Fri, 29 Nov 2019 09:09:00 +0000
test for mask operators
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/tests/unit/simd/vec.cpp b/tests/unit/simd/vec.cpp
@@ -12,6 +12,28 @@ namespace kfr
{
inline namespace CMT_ARCH_NAME
{
+TEST(mask_op)
+{
+ mask<float, 4> m = make_mask<float>(true, false, true, false);
+
+ CHECK(m == make_mask<float>(true, false, true, false));
+
+ m ^= vec<float, 4>(1, 2, 3, 4) < 3;
+
+ CHECK(m == make_mask<float>(false, true, true, false));
+
+ m |= vec<float, 4>(1, 2, 3, 4) < 3;
+
+ CHECK(m == make_mask<float>(true, true, true, false));
+
+ m &= vec<float, 4>(1, 2, 3, 4) < 3;
+
+ CHECK(m == make_mask<float>(true, true, false, false));
+
+ m = ~m;
+
+ CHECK(m == make_mask<float>(false, false, true, true));
+}
TEST(cones)
{
CHECK(vec<int, 2>(cones) == vec<int, 2>(-1, -1));