summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Watry <awatry@gmail.com>2014-06-20 11:14:10 -0500
committerAaron Watry <awatry@gmail.com>2014-06-20 14:33:13 -0500
commita166fc6ccfb6244a5e260ddcef44e6f419721d9e (patch)
tree940d7512c9fc484290e2a27da9b5a87e2922cc4d
parent21b355e330b847efa7ee51a5b87ba7c1aa58620c (diff)
cl: Add signbit(float) relational tests
Also, while doing this, needed to add a NEGNAN define to genclbuiltins.py because python just prints nan for float("-nan") when generating tests. cl-program-tester can handle -nan as an input correctly, so just pass the value through as a string without python attempting to handle it. v2: Add nan and -nan tests Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard@amd.com> CC: Tom Stellard <thomas.stellard@amd.com>
-rw-r--r--generated_tests/genclbuiltins.py3
-rw-r--r--generated_tests/generate-cl-relational-builtins.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 2d2b32266..9173cdbb5 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -56,6 +56,7 @@ UMAX = 'unsigned_max_for_type'
TYPE = 'TYPE'
SIZE = 'SIZE'
TRUE = 'true_value_for_type' #1 for scalar, -1 for vector
+NEGNAN = 'Negative NAN as a string, because float("-nan") just produces nan'
# Identity type list
T = {
@@ -234,6 +235,8 @@ def getValue(type, val, isVector):
return -1
else:
return 1
+ elif (val == NEGNAN):
+ return '-nan' #cl-program-tester translates this for us
else:
print('Unknown string value: ' + val + '\n')
elif (isinstance(val, list)):
diff --git a/generated_tests/generate-cl-relational-builtins.py b/generated_tests/generate-cl-relational-builtins.py
index dd9bc358f..db7b7f596 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -27,7 +27,7 @@
import os
-from genclbuiltins import gen, TRUE
+from genclbuiltins import gen, TRUE, NEGNAN
CLC_VERSION_MIN = {
'isnan' : 10,
@@ -35,6 +35,7 @@ CLC_VERSION_MIN = {
'isgreater' : 10,
'isgreaterequal' : 10,
'isnotequal' : 10,
+ 'signbit' : 10
}
DATA_TYPES = ['float']
@@ -91,6 +92,14 @@ tests = {
[0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
[0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
]
+ },
+ 'signbit' : {
+ 'arg_types': [I, F],
+ 'function_type': 'ttt',
+ 'values': [
+ [0, TRUE, 0, 0, TRUE, 0, TRUE, 0 , TRUE ], # Result
+ [0.0, float(0)*-1, 1.0, 1, float("-inf"), float("inf"), -1.0, float("nan"), NEGNAN ] # Arg0
+ ]
}
}