From: José Fonseca Date: Tue, 15 May 2012 21:38:53 +0000 (+0100) Subject: llvmpipe: Add a test for lp_build_sgn. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5994a641d86f2fef78d804065bd466990b099b62;p=mesa.git llvmpipe: Add a test for lp_build_sgn. Only floating point though, but better than nothing. --- 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 }, };