aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-07-18 03:33:22 -0400
committerZack Rusin <[email protected]>2013-07-19 16:29:18 -0400
commitf59cb673764905560f840651f7d1dcc01f592168 (patch)
treeadce6e6a78c8c7befbd07b8f9adf00d5744a7984 /src/gallium/drivers/llvmpipe
parentf7c06785d08156320836ee94552e7f89e1542647 (diff)
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 <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_arit.c28
1 files changed, 19 insertions, 9 deletions
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 },