[Piglit] [PATCH 5/5] cl: Add signbit(float) relational tests

Tom Stellard tom at stellard.net
Thu Jun 12 16:40:49 PDT 2014


On Wed, Jun 11, 2014 at 02:14:15PM -0500, Aaron Watry wrote:
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
>  generated_tests/generate-cl-relational-builtins.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/generated_tests/generate-cl-relational-builtins.py b/generated_tests/generate-cl-relational-builtins.py
> index f22f5d1..833a836 100644
> --- a/generated_tests/generate-cl-relational-builtins.py
> +++ b/generated_tests/generate-cl-relational-builtins.py
> @@ -34,6 +34,7 @@ CLC_VERSION_MIN = {
>      'isgreater' : 10,
>      'isgreaterequal' : 10,
>      'isnotequal' : 10,
> +    'signbit' : 10
>  }
>  
>  DATA_TYPES = ['float']
> @@ -81,6 +82,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 ], # Result

According to the man page for signbit, -inf, inf, and nan all have a
signbit.  I'm assuming OpenCL C is the same since it is based on C99,
so the inf case should be TRUE and I think it would be a good idea to
add a case for nan.

Also, have you verified that float(0)*-1 generates -0.0 ?

-Tom

> +            [0.0, float(0)*-1, 1.0, 1, float("-inf"), float("inf"), -1.0 ]  # Arg0
> +        ]
>      }
>  }
>  
> -- 
> 1.9.1
> 


More information about the Piglit mailing list