summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generated_tests/CMakeLists.txt4
-rw-r--r--generated_tests/genclbuiltins.py2
-rw-r--r--generated_tests/generate-cl-math-builtins.py66
-rw-r--r--tests/all_cl.tests1
4 files changed, 72 insertions, 1 deletions
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index a0ba4b1bb..2a1c3ff34 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -60,6 +60,9 @@ piglit_make_generated_tests(
piglit_make_generated_tests(
cl_store_tests.list
generate-cl-store-tests.py)
+piglit_make_generated_tests(
+ builtin_cl_math_tests.list
+ generate-cl-math-builtins.py)
# Add a "gen-tests" target that can be used to generate all the
# tests without doing any other compilation.
@@ -68,6 +71,7 @@ add_custom_target(gen-tests ALL
builtin_uniform_tests.list
constant_array_size_tests.list
builtin_cl_int_tests.list
+ builtin_cl_math_tests.list
cl_store_tests.list
interpolation_tests.list
non-lvalue_tests.list
diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 29dfe3972..721191e3a 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -252,7 +252,7 @@ def getValue(type, val):
getValue(type, val[3]), getValue(type, val[4]))
# At this point, we should have been passed a number
- if (isinstance(val, (int, long))):
+ if (isinstance(val, (int, long, float))):
return val
print('Invalid value '+repr(val)+' encountered in getValue\n')
diff --git a/generated_tests/generate-cl-math-builtins.py b/generated_tests/generate-cl-math-builtins.py
new file mode 100644
index 000000000..25143bada
--- /dev/null
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard <thomas.stellard@amd.com>
+#
+
+import os
+
+from genclbuiltins import gen
+
+CLC_VERSION_MIN = {
+ 'nextafter' : 10
+}
+
+DATA_TYPES = ['float']
+
+F = {
+ 'float' : 'float'
+}
+
+tests = {
+ 'nextafter' : {
+ 'arg_types': [F, F, F],
+ 'function_type': 'ttt',
+ 'values': [
+ [1.401298e-45, -1.401298e-45, 1.00000011920928955078125, 0.999999940395355224609375, float("nan"), float("nan"), 5.0 ], # Result
+ [0.0, 0.0 , 1.0, 1.0, float("nan"), 2.5, 5.0], # Arg0
+ [1.0, -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # Arg1
+ ]
+ }
+}
+
+
+def main():
+ dirName = os.path.join("cl", "builtin", "math")
+
+ testDefs = {}
+ functions = sorted(tests.keys())
+ for dataType in DATA_TYPES:
+ for fnName in functions:
+ testDefs[(dataType, fnName)] = tests[fnName]
+
+ gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
+
+
+main()
diff --git a/tests/all_cl.tests b/tests/all_cl.tests
index 367319afc..b0aa9d79b 100644
--- a/tests/all_cl.tests
+++ b/tests/all_cl.tests
@@ -113,6 +113,7 @@ add_program_test_dir(program_execute, 'tests/cl/program/execute/builtin/atomic')
program_execute_builtin = Group()
program["Execute"]["Builtin"] = program_execute_builtin
add_program_test_dir(program_execute_builtin, 'generated_tests/cl/builtin/int')
+add_program_test_dir(program_execute_builtin, 'generated_tests/cl/builtin/math')
program_execute_store = Group()
program["Execute"]["Store"] = program_execute_store
add_program_test_dir(program_execute_store, 'generated_tests/cl/store')