[Piglit] [PATCH 1/2 v2] genclbuiltins.py: Add two new function types.

Yi Sun yi.sun at intel.com
Thu Oct 31 17:20:46 CET 2013


Sometimes we should handle scalar/vector types separately.
For example some builtin functions only support scalar type input,
and some relational builtin functions get different results between
scalar and vector type though with the same value.

Signed-off-by: Yi Sun <yi.sun at intel.com>

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
old mode 100644
new mode 100755
index 721191e..e7757a7
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -22,6 +22,9 @@ VEC_WIDTHS = [2, 4, 8, 16]
 # ALL_WIDTHS = [1, 2, 3, 4, 8, 16]
 ALL_WIDTHS = [1, 2, 4, 8, 16]
 
+# According to CL1.1/1.2 spec, some built-in functions only take scalar type as input.
+SCALAR_WIDTHS = [1]
+
 MIN_VALUES = {
     'char': -128,
     'uchar': 0,
@@ -377,8 +380,16 @@ def gen(types, minVersions, functions, testDefs, dirName):
             numTests = len(outputValues)
 
             # Handle all available scalar/vector widths
-            sizes = sorted(VEC_WIDTHS)
-            sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
+            if functionDef['function_type'] == 'ttt' or functionDef['function_type'] == 'tss':
+                sizes = sorted(ALL_WIDTHS)
+            # Add two new function_type types:
+            # 'vvv' means handle available vdctor widths only
+            # 'sss' means handle available scalar width only
+            if functionDef['function_type'] == 'vvv':
+                sizes = sorted(VEC_WIDTHS)
+            if functionDef['function_type'] == 'sss':
+                sizes = sorted(SCALAR_WIDTHS)
+
             for vecSize in sizes:
                 for testIdx in range(0, numTests):
                     print_test(f, fnName, dataType, functionDef, tests,
-- 
1.7.6.4



More information about the Piglit mailing list