[Libclc-dev] [PATCH] Move clcmacro.h to avoid cluttering user namespace v2

Jeroen Ketema j.ketema at imperial.ac.uk
Tue Jun 24 02:45:40 PDT 2014


Committed. Thanks for your reviews Aaron and Tom.

Jeroen

On 23 Jun 2014, at 17:45, Aaron Watry <awatry at gmail.com> wrote:

> Reviewed-by: Aaron Watry <awatry at gmail.com>
> 
> On Mon, Jun 23, 2014 at 11:33 AM, Jeroen Ketema <j.ketema at imperial.ac.uk> wrote:
>> v2: - use quotes instead of <>
>>   - add include to r600/lib/math/nextafter.c
>> ---
>> generic/include/clc/clc.h         |  3 ---
>> generic/include/clc/clcmacro.h    | 54 ---------------------------------------
>> generic/lib/clcmacro.h            | 54 +++++++++++++++++++++++++++++++++++++++
>> generic/lib/common/sign.cl        |  1 +
>> generic/lib/integer/add_sat.cl    |  1 +
>> generic/lib/integer/clz.cl        |  1 +
>> generic/lib/integer/sub_sat.cl    |  1 +
>> generic/lib/math/clc_nextafter.cl |  1 +
>> generic/lib/math/nextafter.cl     |  1 +
>> generic/lib/math/pown.cl          |  1 +
>> generic/lib/relational/isnan.cl   |  1 +
>> r600/lib/math/nextafter.cl        |  1 +
>> 12 files changed, 63 insertions(+), 57 deletions(-)
>> delete mode 100644 generic/include/clc/clcmacro.h
>> create mode 100644 generic/lib/clcmacro.h
>> 
>> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
>> index a975c0d..c7c8dfb 100644
>> --- a/generic/include/clc/clc.h
>> +++ b/generic/include/clc/clc.h
>> @@ -11,9 +11,6 @@
>> /* Function Attributes */
>> #include <clc/clcfunc.h>
>> 
>> -/* Pattern Macro Definitions */
>> -#include <clc/clcmacro.h>
>> -
>> /* 6.1 Supported Data Types */
>> #include <clc/clctypes.h>
>> 
>> diff --git a/generic/include/clc/clcmacro.h b/generic/include/clc/clcmacro.h
>> deleted file mode 100644
>> index 730073a..0000000
>> --- a/generic/include/clc/clcmacro.h
>> +++ /dev/null
>> @@ -1,54 +0,0 @@
>> -#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
>> -  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
>> -    return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
>> -    return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
>> -    return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
>> -    return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
>> -    return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> -  }
>> -
>> -#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
>> -  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
>> -    return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
>> -    return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
>> -                         FUNCTION(x.z, y.z)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
>> -    return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
>> -    return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> -  } \
>> -\
>> -  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
>> -    return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> -  }
>> -
>> -#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
>> -_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
>> -  return BUILTIN(x, y); \
>> -} \
>> -_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
>> -
>> -#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
>> -_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
>> -  return BUILTIN(x); \
>> -} \
>> -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
>> diff --git a/generic/lib/clcmacro.h b/generic/lib/clcmacro.h
>> new file mode 100644
>> index 0000000..730073a
>> --- /dev/null
>> +++ b/generic/lib/clcmacro.h
>> @@ -0,0 +1,54 @@
>> +#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
>> +  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
>> +    return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
>> +    return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
>> +    return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
>> +    return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
>> +    return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
>> +  }
>> +
>> +#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
>> +  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
>> +    return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
>> +    return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
>> +                         FUNCTION(x.z, y.z)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
>> +    return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
>> +    return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> +  } \
>> +\
>> +  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
>> +    return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
>> +  }
>> +
>> +#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
>> +_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
>> +  return BUILTIN(x, y); \
>> +} \
>> +_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
>> +
>> +#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
>> +_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
>> +  return BUILTIN(x); \
>> +} \
>> +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
>> diff --git a/generic/lib/common/sign.cl b/generic/lib/common/sign.cl
>> index 070abd5..25832e0 100644
>> --- a/generic/lib/common/sign.cl
>> +++ b/generic/lib/common/sign.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> #define SIGN(TYPE, F) \
>> _CLC_DEF _CLC_OVERLOAD TYPE sign(TYPE x) { \
>> diff --git a/generic/lib/integer/add_sat.cl b/generic/lib/integer/add_sat.cl
>> index 7eb4e39..d4df66d 100644
>> --- a/generic/lib/integer/add_sat.cl
>> +++ b/generic/lib/integer/add_sat.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> // From add_sat.ll
>> _CLC_DECL char   __clc_add_sat_s8(char, char);
>> diff --git a/generic/lib/integer/clz.cl b/generic/lib/integer/clz.cl
>> index 83ef2dd..17e3fe0 100644
>> --- a/generic/lib/integer/clz.cl
>> +++ b/generic/lib/integer/clz.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> // From clz.ll
>> _CLC_DECL char   __clc_clz_s8(char);
>> diff --git a/generic/lib/integer/sub_sat.cl b/generic/lib/integer/sub_sat.cl
>> index 9555b6d..6b42cc8 100644
>> --- a/generic/lib/integer/sub_sat.cl
>> +++ b/generic/lib/integer/sub_sat.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> // From sub_sat.ll
>> _CLC_DECL char   __clc_sub_sat_s8(char, char);
>> diff --git a/generic/lib/math/clc_nextafter.cl b/generic/lib/math/clc_nextafter.cl
>> index 92b990d..e53837d 100644
>> --- a/generic/lib/math/clc_nextafter.cl
>> +++ b/generic/lib/math/clc_nextafter.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> // This file provides OpenCL C implementations of nextafter for targets that
>> // don't support the clang builtin.
>> diff --git a/generic/lib/math/nextafter.cl b/generic/lib/math/nextafter.cl
>> index 1a7f169..cbe54cd 100644
>> --- a/generic/lib/math/nextafter.cl
>> +++ b/generic/lib/math/nextafter.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __builtin_nextafterf, float, float)
>> 
>> diff --git a/generic/lib/math/pown.cl b/generic/lib/math/pown.cl
>> index 46b354b..f3b27d4 100644
>> --- a/generic/lib/math/pown.cl
>> +++ b/generic/lib/math/pown.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, pown, float, int)
>> 
>> diff --git a/generic/lib/relational/isnan.cl b/generic/lib/relational/isnan.cl
>> index 1a64f67..ab5d58a 100644
>> --- a/generic/lib/relational/isnan.cl
>> +++ b/generic/lib/relational/isnan.cl
>> @@ -1,4 +1,5 @@
>> #include <clc/clc.h>
>> +#include "../clcmacro.h"
>> 
>> _CLC_DEFINE_UNARY_BUILTIN(int, isnan, __builtin_isnan, float)
>> 
>> diff --git a/r600/lib/math/nextafter.cl b/r600/lib/math/nextafter.cl
>> index 54bed5f..4611c81 100644
>> --- a/r600/lib/math/nextafter.cl
>> +++ b/r600/lib/math/nextafter.cl
>> @@ -1,3 +1,4 @@
>> #include <clc/clc.h>
>> +#include "../lib/clcmacro.h"
>> 
>> _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float)
>> --
>> 1.8.5.2 (Apple Git-48)
>> 
>> 
>> _______________________________________________
>> Libclc-dev mailing list
>> Libclc-dev at pcc.me.uk
>> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev





More information about the Libclc-dev mailing list