[Piglit] [PATCH 2/2] The return code of the fucntion isnan is -1 for vector types.

Tom Stellard tom at stellard.net
Wed Oct 30 23:57:45 CET 2013


On Wed, Oct 30, 2013 at 04:01:10PM +0800, Yi Sun wrote:
> According to the OpenCL spec version 1.2/1.1 chacpter 6.12.6:
> The functions isequal, isnotequal, isgreater, isgreaterequal, isless, islessequal, islessgreater,
> isfinite, isinf, isnan, isnormal, isordered, isunordered and signbit described in table 6.14 shall
> return a 0 if the specified relation is false and a 1 if the specified relation is true for scalar
> argument types. These functions shall return a 0 if the specified relation is false and a ???1 (i.e. all
> bits set) if the specified relation is true for vector argument types.
> 
> So, here we can remove the scalar argument types. And change the output from 1 to -1.

Why are you are removing the scalar tests?

> 
> Signed-off-by: Yi Sun <yi.sun at intel.com>
> 
> diff --git a/generated_tests/generate-cl-relational-builtins.py b/generated_tests/generate-cl-relational-builtins.py
> old mode 100644
> new mode 100755
> index af6849f..5ed73ca
> --- a/generated_tests/generate-cl-relational-builtins.py
> +++ b/generated_tests/generate-cl-relational-builtins.py
> @@ -47,7 +47,7 @@ tests = {
>          'arg_types': [I, F],
>          'function_type': 'ttt',
>          'values': [
> -            [0,   1,            0,   0],            # Result
> +            [0,   -1,            0,   0],            # Result
>              [0.0, float("nan"), 1.0, float("inf") ] # Arg0
>          ]
>      }
> @@ -63,7 +63,7 @@ def main():
>          for fnName in functions:
>              testDefs[(dataType, fnName)] = tests[fnName]
>  
> -    gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
> +    gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName, [2, 4, 8, 16])
> 

Rather than adding an extra parameter to the gen function, I think it
would be better to add a new 'function_type' : 'vvv' that only operated
on vector types.  This way you could add a new test to the dictionary
for the vector case and leave the old one.  Something like:

'isnan_vector' : {
    'arg_types': [I, F],
    'function_type': 'vvv',
    'values': [
        [0,   -1,            0,   0],            # Result
        [0.0, float("nan"), 1.0, float("inf") ] # Arg0
    ]
}

-Tom


>  
>  main()
> -- 
> 1.7.6.4
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list