Commit f59cb673 authored by Zack Rusin's avatar Zack Rusin
Browse files

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: default avatarZack Rusin <zackr@vmware.com>
Reviewed-by: default avatarJose Fonseca <jfonseca@vmware.com>
Reviewed-by: default avatarRoland Scheidegger <sroland@vmware.com>
parent f7c06785
......@@ -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 },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment