From: Zack Rusin Date: Thu, 18 Jul 2013 07:33:22 +0000 (-0400) Subject: llvmpipe/tests: update arith test to check for edge cases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f59cb673764905560f840651f7d1dcc01f592168;p=mesa.git llvmpipe/tests: update arith test to check for edge cases Test infs, zeros and nans with our arith functions to assure correct/defined behavior with those values. Signed-off-by: Zack Rusin Reviewed-by: Jose Fonseca Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index f14e4b36320..89964114342 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -108,6 +108,7 @@ static float sgnf(float x) const float exp2_values[] = { + -INFINITY, -60, -4, -2, @@ -122,7 +123,9 @@ const float exp2_values[] = { 1, 2, 4, - 60 + 60, + INFINITY, + NAN }; @@ -134,6 +137,8 @@ const float log2_values[] = { */ 1.4012984643248171e-45, #endif + -INFINITY, + 0, 1e-007, 0.1, 0.5, @@ -146,7 +151,9 @@ const float log2_values[] = { 2, 4, 100000, - 1e+018 + 1e+018, + INFINITY, + NAN }; @@ -190,17 +197,20 @@ const float rsqrt_values[] = { const float sincos_values[] = { + -INFINITY, -5*M_PI/4, -4*M_PI/4, -4*M_PI/4, -3*M_PI/4, -2*M_PI/4, -1*M_PI/4, - 1*M_PI/4, - 2*M_PI/4, - 3*M_PI/4, - 4*M_PI/4, - 5*M_PI/4, + 1*M_PI/4, + 2*M_PI/4, + 3*M_PI/4, + 4*M_PI/4, + 5*M_PI/4, + INFINITY, + NAN }; const float round_values[] = { @@ -263,9 +273,9 @@ static const struct unary_test_t unary_tests[] = { {"neg", &lp_build_negate, &negf, exp2_values, Elements(exp2_values), 20.0 }, {"exp2", &lp_build_exp2, &exp2f, exp2_values, Elements(exp2_values), 20.0 }, - {"log2", &lp_build_log2, &log2f, log2_values, Elements(log2_values), 20.0 }, + {"log2", &lp_build_log2_safe, &log2f, log2_values, Elements(log2_values), 20.0 }, {"exp", &lp_build_exp, &expf, exp2_values, Elements(exp2_values), 18.0 }, - {"log", &lp_build_log, &logf, log2_values, Elements(log2_values), 20.0 }, + {"log", &lp_build_log_safe, &logf, log2_values, Elements(log2_values), 20.0 }, {"rcp", &lp_build_rcp, &rcpf, rcp_values, Elements(rcp_values), 20.0 }, {"rsqrt", &lp_build_rsqrt, &rsqrtf, rsqrt_values, Elements(rsqrt_values), 20.0 }, {"sin", &lp_build_sin, &sinf, sincos_values, Elements(sincos_values), 20.0 },