From 5994a641d86f2fef78d804065bd466990b099b62 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 15 May 2012 22:38:53 +0100 Subject: llvmpipe: Add a test for lp_build_sgn. Only floating point though, but better than nothing. --- src/gallium/drivers/llvmpipe/lp_test_arit.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index 9b34efed671..45ca32f5866 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -95,6 +95,18 @@ static float negf(float x) } +static float sgnf(float x) +{ + if (x > 0.0f) { + return 1.0f; + } + if (x < 0.0f) { + return -1.0f; + } + return 0.0f; +} + + const float exp2_values[] = { -60, -4, @@ -183,6 +195,7 @@ unary_tests[] = { {"rsqrt", &lp_build_rsqrt, &rsqrtf, rsqrt_values, Elements(rsqrt_values), 20.0 }, {"sin", &lp_build_sin, &sinf, sincos_values, Elements(sincos_values), 20.0 }, {"cos", &lp_build_cos, &cosf, sincos_values, Elements(sincos_values), 20.0 }, + {"sgn", &lp_build_sgn, &sgnf, exp2_values, Elements(exp2_values), 20.0 }, }; -- cgit v1.2.3