diff options
| author | Tom Stellard <thomas.stellard@amd.com> | 2013-07-08 17:27:02 +0000 |
|---|---|---|
| committer | Tom Stellard <thomas.stellard@amd.com> | 2013-07-08 17:27:02 +0000 |
| commit | d768ac0395f7f9e2146f9522b3a120f379a1a934 (patch) | |
| tree | 474f3ac3319c850f842f80d79d59c6500130deb4 /libclc/generic/lib/integer | |
| parent | 3a81b5d083b0d025de71013fbf68003ebd28cf30 (diff) | |
| download | bcm5719-llvm-d768ac0395f7f9e2146f9522b3a120f379a1a934.tar.gz bcm5719-llvm-d768ac0395f7f9e2146f9522b3a120f379a1a934.zip | |
Add __CLC_ prefix to all macro definitions in headers
libclc was defining and undefing GENTYPE and several other macros with
common names in its header files. This was preventing applications from
defining macros with identical names as command line arguments to the
compiler, because the definitions in the header files were masking the
macros defined as compiler arguements.
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 185838
Diffstat (limited to 'libclc/generic/lib/integer')
| -rw-r--r-- | libclc/generic/lib/integer/abs.cl | 2 | ||||
| -rw-r--r-- | libclc/generic/lib/integer/abs.inc | 4 | ||||
| -rw-r--r-- | libclc/generic/lib/integer/abs_diff.cl | 2 | ||||
| -rw-r--r-- | libclc/generic/lib/integer/abs_diff.inc | 4 | ||||
| -rw-r--r-- | libclc/generic/lib/integer/rotate.cl | 2 | ||||
| -rw-r--r-- | libclc/generic/lib/integer/rotate.inc | 30 |
6 files changed, 22 insertions, 22 deletions
diff --git a/libclc/generic/lib/integer/abs.cl b/libclc/generic/lib/integer/abs.cl index 86f1a34c172..faff8d05fef 100644 --- a/libclc/generic/lib/integer/abs.cl +++ b/libclc/generic/lib/integer/abs.cl @@ -1,4 +1,4 @@ #include <clc/clc.h> -#define BODY <abs.inc> +#define __CLC_BODY <abs.inc> #include <clc/integer/gentype.inc> diff --git a/libclc/generic/lib/integer/abs.inc b/libclc/generic/lib/integer/abs.inc index fff6691274a..cfe7bfecd29 100644 --- a/libclc/generic/lib/integer/abs.inc +++ b/libclc/generic/lib/integer/abs.inc @@ -1,3 +1,3 @@ -_CLC_OVERLOAD _CLC_DEF UGENTYPE abs(GENTYPE x) { - return __builtin_astype((GENTYPE)(x > (GENTYPE)(0) ? x : -x), UGENTYPE); +_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs(__CLC_GENTYPE x) { + return __builtin_astype((__CLC_GENTYPE)(x > (__CLC_GENTYPE)(0) ? x : -x), __CLC_U_GENTYPE); } diff --git a/libclc/generic/lib/integer/abs_diff.cl b/libclc/generic/lib/integer/abs_diff.cl index c9ca8213c32..3d751057819 100644 --- a/libclc/generic/lib/integer/abs_diff.cl +++ b/libclc/generic/lib/integer/abs_diff.cl @@ -1,4 +1,4 @@ #include <clc/clc.h> -#define BODY <abs_diff.inc> +#define __CLC_BODY <abs_diff.inc> #include <clc/integer/gentype.inc> diff --git a/libclc/generic/lib/integer/abs_diff.inc b/libclc/generic/lib/integer/abs_diff.inc index 6ad57eed367..f39c3ff4d3e 100644 --- a/libclc/generic/lib/integer/abs_diff.inc +++ b/libclc/generic/lib/integer/abs_diff.inc @@ -1,3 +1,3 @@ -_CLC_OVERLOAD _CLC_DEF UGENTYPE abs_diff(GENTYPE x, GENTYPE y) { - return __builtin_astype((GENTYPE)(x > y ? x-y : y-x), UGENTYPE); +_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y) { + return __builtin_astype((__CLC_GENTYPE)(x > y ? x-y : y-x), __CLC_U_GENTYPE); } diff --git a/libclc/generic/lib/integer/rotate.cl b/libclc/generic/lib/integer/rotate.cl index d7eff2b1c84..27ce515c729 100644 --- a/libclc/generic/lib/integer/rotate.cl +++ b/libclc/generic/lib/integer/rotate.cl @@ -1,4 +1,4 @@ #include <clc/clc.h> -#define BODY <rotate.inc> +#define __CLC_BODY <rotate.inc> #include <clc/integer/gentype.inc> diff --git a/libclc/generic/lib/integer/rotate.inc b/libclc/generic/lib/integer/rotate.inc index 2aa6cc9d9fb..33bb0a85241 100644 --- a/libclc/generic/lib/integer/rotate.inc +++ b/libclc/generic/lib/integer/rotate.inc @@ -7,36 +7,36 @@ * Eventually, someone should feel free to implement an llvm-specific version */ -_CLC_OVERLOAD _CLC_DEF GENTYPE rotate(GENTYPE x, GENTYPE n){ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE n){ //Try to avoid extra work if someone's spinning the value through multiple //full rotations - n = n % (GENTYPE)GENSIZE; + n = n % (__CLC_GENTYPE)__CLC_GENSIZE; -#ifdef SCALAR +#ifdef __CLC_SCALAR if (n > 0){ - return (x << n) | (((UGENTYPE)x) >> (GENSIZE - n)); + return (x << n) | (((__CLC_U_GENTYPE)x) >> (__CLC_GENSIZE - n)); } else if (n == 0){ return x; } else { - return ( (((UGENTYPE)x) >> -n) | (x << (GENSIZE + n)) ); + return ( (((__CLC_U_GENTYPE)x) >> -n) | (x << (__CLC_GENSIZE + n)) ); } #else //XXX: There's a lot of __builtin_astype calls to cast everything to - // unsigned ... This should be improved so that if GENTYPE==UGENTYPE, no + // unsigned ... This should be improved so that if __CLC_GENTYPE==__CLC_U_GENTYPE, no // casts are required. - UGENTYPE x_1 = __builtin_astype(x, UGENTYPE); + __CLC_U_GENTYPE x_1 = __builtin_astype(x, __CLC_U_GENTYPE); - //XXX: Is (UGENTYPE >> SGENTYPE) | (UGENTYPE << SGENTYPE) legal? + //XXX: Is (__CLC_U_GENTYPE >> S__CLC_GENTYPE) | (__CLC_U_GENTYPE << S__CLC_GENTYPE) legal? // If so, then combine the amt and shifts into a single set of statements - UGENTYPE amt; - amt = (n < (GENTYPE)0 ? __builtin_astype((GENTYPE)0-n, UGENTYPE) : (UGENTYPE)0); - x_1 = (x_1 >> amt) | (x_1 << ((UGENTYPE)GENSIZE - amt)); + __CLC_U_GENTYPE amt; + amt = (n < (__CLC_GENTYPE)0 ? __builtin_astype((__CLC_GENTYPE)0-n, __CLC_U_GENTYPE) : (__CLC_U_GENTYPE)0); + x_1 = (x_1 >> amt) | (x_1 << ((__CLC_U_GENTYPE)__CLC_GENSIZE - amt)); - amt = (n < (GENTYPE)0 ? (UGENTYPE)0 : __builtin_astype(n, UGENTYPE)); - x_1 = (x_1 << amt) | (x_1 >> ((UGENTYPE)GENSIZE - amt)); + amt = (n < (__CLC_GENTYPE)0 ? (__CLC_U_GENTYPE)0 : __builtin_astype(n, __CLC_U_GENTYPE)); + x_1 = (x_1 << amt) | (x_1 >> ((__CLC_U_GENTYPE)__CLC_GENSIZE - amt)); - return __builtin_astype(x_1, GENTYPE); + return __builtin_astype(x_1, __CLC_GENTYPE); #endif -}
\ No newline at end of file +} |

