commit 4fa2e0b5faccd98e265ef90188da2d48d15ed5b2
parent 562be0bf35d3f00b723c91997a229969c35c6c28
Author: vaplv <vaplv@free.fr>
Date: Fri, 7 Nov 2014 15:49:22 +0100
Add and test the v4f_mask1 function
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/sse/ssef.h b/src/sse/ssef.h
@@ -90,6 +90,12 @@ v4f_mask(const int32_t x, const int32_t y, const int32_t z, const int32_t w)
}
static FINLINE v4f_T
+v4f_mask1(const int32_t x)
+{
+ return _mm_castsi128_ps(_mm_set1_epi32(x));
+}
+
+static FINLINE v4f_T
v4f_true(void)
{
return _mm_castsi128_ps(_mm_set1_epi32(~0));
diff --git a/src/test_v4f.c b/src/test_v4f.c
@@ -72,6 +72,12 @@ main(int argc, char** argv)
cast.f[2] = v4f_z(i); CHECK(cast.i[2], (int32_t)0xFFFFFFFF);
cast.f[3] = v4f_w(i); CHECK(cast.i[3], (int32_t)0xFFFFFFFF);
+ i = v4f_mask1(8);
+ cast.f[0] = v4f_x(i); CHECK(cast.i[0], 8);
+ cast.f[1] = v4f_y(i); CHECK(cast.i[1], 8);
+ cast.f[2] = v4f_z(i); CHECK(cast.i[2], 8);
+ cast.f[3] = v4f_w(i); CHECK(cast.i[3], 8);
+
i = v4f_true();
cast.f[0] = v4f_x(i); CHECK(cast.i[0], (int32_t)0xFFFFFFFF);
cast.f[1] = v4f_y(i); CHECK(cast.i[1], (int32_t)0xFFFFFFFF);