[Libclc-dev] [PATCH] Fix definition of INFINITY and add NAN/HUGE_VAL[F]
Matt Arsenault
arsenm2 at gmail.com
Sun Jun 15 15:10:16 PDT 2014
On Jun 15, 2014, at 2:43 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:
>
> On Jun 11, 2014, at 4:34 PM, Aaron Watry <awatry at gmail.com> wrote:
>
>> v2: use __builtin_inff() and also add nan/huge_val definitions
>>
>> Signed-off-by: Aaron Watry <awatry at gmail.com>
>> ---
>> generic/include/clc/float/definitions.h | 6 ++++++
>> generic/lib/gen_convert.py | 2 --
>> 2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/generic/include/clc/float/definitions.h b/generic/include/clc/float/definitions.h
>> index af54fdf..c286bb9 100644
>> --- a/generic/include/clc/float/definitions.h
>> +++ b/generic/include/clc/float/definitions.h
>> @@ -1,3 +1,7 @@
>> +#define INFINITY __builtin_inff()
>> +#define NAN __builtin_nanf()
>> +#define HUGE_VALF __builtin_huge_valf()
>
>
> I’m getting an error when I try to use this. Apparently __builtin_nanf expects a string argument
>
> 4 errors generated.
> 95: divide FAILED -- clBuildProgram() failed: (-11)
> Log: input.cl:18:40: error: too few arguments to function call, expected 1, have 0
> f0 = (float3)( in[3*i], NAN, NAN );
> ^~~
> /usr/local/include/clc/float/definitions.h:2:28: note: expanded from macro 'NAN'
> #define NAN __builtin_nanf()
> ~~~~~~~~~~~~~~ ^
> input.cl:19:41: error: too few arguments to function call, expected 1, have 0
> f1 = (float3)( in2[3*i], NAN, NAN );
> ^~~
> /usr/local/include/clc/float/definitions.h:2:28: note: expanded from macro 'NAN'
> #define NAN __builtin_nanf()
> ~~~~~~~~~~~~~~ ^
> input.cl:22:51: error: too few arguments to function call, expected 1, have 0
> f0 = (float3)( in[3*i], in[3*i+1], NAN );
> ^~~
> /usr/local/include/clc/float/definitions.h:2:28: note: expanded from macro 'NAN'
> #define NAN __builtin_nanf()
> ~~~~~~~~~~~~~~ ^
> input.cl:23:53: error: too few arguments to function call, expected 1, have 0
> f1 = (float3)( in2[3*i], in2[3*i+1], NAN );
> ^~~
> /usr/local/include/clc/float/definitions.h:2:28: note: expanded from macro 'NAN'
> #define NAN __builtin_nanf()
> ~~~~~~~~~~~~~~ ^
This needs to be replaced with:
:#define NAN __builtin_nanf((const __attribute__((address_space(2))) char *)(""))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20140615/19562f90/attachment.html>
More information about the Libclc-dev
mailing list