summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-05-15 22:38:53 +0100
committerJosé Fonseca <[email protected]>2012-05-15 22:39:25 +0100
commit5994a641d86f2fef78d804065bd466990b099b62 (patch)
treebae8ed6932c50e0915264dd0be7ecc8f5db5b1d9 /src
parent9fb4eef6a159fb5af97694b15a5f9b5998e9f6e5 (diff)
llvmpipe: Add a test for lp_build_sgn.
Only floating point though, but better than nothing.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_arit.c13
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 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 },
};