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

Aaron Watry awatry at gmail.com
Tue Jun 17 06:50:00 PDT 2014


On Thu, Jun 12, 2014 at 6:40 PM, Tom Stellard <tom at stellard.net> wrote:
> 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.

I'll do that (add [+-]NAN and -INF tests) and send a v2 of this patch
separate from the rest of the series, which I think it ready to go.

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

Yes...  after quite a bit of searching, that was the only way I found
to get python to generate a negative 0. Maybe there's others, but
float(-0.0) and several other variants all generate a positive 0
instead.

--Aaron

>
> -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