Module: Mesa Branch: master Commit: 5994a641d86f2fef78d804065bd466990b099b62 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5994a641d86f2fef78d804065bd466990b099b62
Author: José Fonseca <[email protected]> Date: Tue May 15 22:38:53 2012 +0100 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 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index 9b34efe..45ca32f 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 }, }; _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
