diff options
| author | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-10 22:16:15 +0000 |
|---|---|---|
| committer | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-10 22:16:15 +0000 |
| commit | f58dee9f3a5773dfebcd60df60781c12def0f718 (patch) | |
| tree | 22f1dffa84fa6d013dff404b2e7080c47c18e1c2 /libclc | |
| parent | 4abbbcc1998fd08a5a3a5bb266914ec1cb12ab2e (diff) | |
| download | bcm5719-llvm-f58dee9f3a5773dfebcd60df60781c12def0f718.tar.gz bcm5719-llvm-f58dee9f3a5773dfebcd60df60781c12def0f718.zip | |
native_log2: Switch to generic native intrinsic inc file
v2: Add __CLC_XCONCAT instead of function name redirection
Use __CLC_XCONCAT for intrinsic functions as well
Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317932
Diffstat (limited to 'libclc')
| -rw-r--r-- | libclc/generic/include/utils.h | 10 | ||||
| -rw-r--r-- | libclc/generic/lib/math/native_log2.cl | 8 | ||||
| -rw-r--r-- | libclc/generic/lib/math/native_unary_intrinsic.inc (renamed from libclc/generic/lib/math/native_log2.inc) | 19 |
3 files changed, 29 insertions, 8 deletions
diff --git a/libclc/generic/include/utils.h b/libclc/generic/include/utils.h new file mode 100644 index 00000000000..018a7b31f8f --- /dev/null +++ b/libclc/generic/include/utils.h @@ -0,0 +1,10 @@ +#ifndef __CLC_UTILS_H_ +#define __CLC_UTILS_H_ + +#define __CLC_CONCAT(x, y) x ## y +#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y) + +#define __CLC_STR(x) #x +#define __CLC_XSTR(x) __CLC_STR(x) + +#endif diff --git a/libclc/generic/lib/math/native_log2.cl b/libclc/generic/lib/math/native_log2.cl index 35ed18b0d5b..b6104237ab2 100644 --- a/libclc/generic/lib/math/native_log2.cl +++ b/libclc/generic/lib/math/native_log2.cl @@ -22,11 +22,7 @@ #include <clc/clc.h> -#define __CLC_FUNCTION __clc_native_log2 -#define __CLC_INTRINSIC "llvm.log2" -#undef cl_khr_fp64 -#include <clc/math/unary_intrin.inc> - -#define __CLC_BODY <native_log2.inc> +#define __CLC_NATIVE_INTRINSIC log2 +#define __CLC_BODY <native_unary_intrinsic.inc> #define __FLOAT_ONLY #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/native_log2.inc b/libclc/generic/lib/math/native_unary_intrinsic.inc index 0f6a5098c04..dbea2882a12 100644 --- a/libclc/generic/lib/math/native_log2.inc +++ b/libclc/generic/lib/math/native_unary_intrinsic.inc @@ -20,6 +20,21 @@ * THE SOFTWARE. */ -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log2(__CLC_GENTYPE val) { - return __clc_native_log2(val); +#include <utils.h> + +#ifdef __CLC_SCALAR +#define __CLC_FUNCTION __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC) +#define __CLC_INTRINSIC "llvm." __CLC_XSTR(__CLC_NATIVE_INTRINSIC) + +#undef cl_khr_fp64 +#include <clc/math/unary_intrin.inc> + +#endif + +#define __CLC_FUNCTION __CLC_XCONCAT(native_, __CLC_NATIVE_INTRINSIC) + +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE val) { + return __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)(val); } + +#undef __CLC_FUNCTION |

