diff options
23 files changed, 93 insertions, 111 deletions
diff --git a/libclc/clc/include/clc/math/unary_builtin.inc b/libclc/clc/include/clc/math/unary_builtin.inc deleted file mode 100644 index 790eaec..0000000 --- a/libclc/clc/include/clc/math/unary_builtin.inc +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <clc/clcmacro.h> -#include <clc/utils.h> - -#ifndef __CLC_BUILTIN -#define __CLC_BUILTIN __CLC_XCONCAT(__clc_, __CLC_FUNCTION) -#endif - -_CLC_DEFINE_UNARY_BUILTIN(float, __CLC_FUNCTION, __CLC_BUILTIN, float) - -#ifdef cl_khr_fp64 - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -_CLC_DEFINE_UNARY_BUILTIN(double, __CLC_FUNCTION, __CLC_BUILTIN, double) - -#endif - -#ifdef cl_khr_fp16 - -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -_CLC_DEFINE_UNARY_BUILTIN(half, __CLC_FUNCTION, __CLC_BUILTIN, half) - -#endif diff --git a/libclc/clc/lib/generic/math/clc_ceil.cl b/libclc/clc/lib/generic/math/clc_ceil.cl index 975b511..c4df638 100644 --- a/libclc/clc/lib/generic/math/clc_ceil.cl +++ b/libclc/clc/lib/generic/math/clc_ceil.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_ceil -#define __CLC_BUILTIN __builtin_elementwise_ceil -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_ceil +#define __CLC_FUNCTION(x) __builtin_elementwise_ceil +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/math/clc_fabs.cl b/libclc/clc/lib/generic/math/clc_fabs.cl index 90841af..f684c1e 100644 --- a/libclc/clc/lib/generic/math/clc_fabs.cl +++ b/libclc/clc/lib/generic/math/clc_fabs.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_fabs -#define __CLC_BUILTIN __builtin_elementwise_abs -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_fabs +#define __CLC_FUNCTION(x) __builtin_elementwise_abs +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/math/clc_floor.cl b/libclc/clc/lib/generic/math/clc_floor.cl index 2b80e5b..0626ba3 100644 --- a/libclc/clc/lib/generic/math/clc_floor.cl +++ b/libclc/clc/lib/generic/math/clc_floor.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_floor -#define __CLC_BUILTIN __builtin_elementwise_floor -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_floor +#define __CLC_FUNCTION(x) __builtin_elementwise_floor +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/math/clc_rint.cl b/libclc/clc/lib/generic/math/clc_rint.cl index d0852bc..2188a7d 100644 --- a/libclc/clc/lib/generic/math/clc_rint.cl +++ b/libclc/clc/lib/generic/math/clc_rint.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_rint -#define __CLC_BUILTIN __builtin_elementwise_rint -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_rint +#define __CLC_FUNCTION(x) __builtin_elementwise_rint +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/math/clc_round.cl b/libclc/clc/lib/generic/math/clc_round.cl index 9819490..e784dbe 100644 --- a/libclc/clc/lib/generic/math/clc_round.cl +++ b/libclc/clc/lib/generic/math/clc_round.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_round -#define __CLC_BUILTIN __builtin_elementwise_round -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_round +#define __CLC_FUNCTION(x) __builtin_elementwise_round +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/math/clc_trunc.cl b/libclc/clc/lib/generic/math/clc_trunc.cl index 3aa47ea..0bf2bc4 100644 --- a/libclc/clc/lib/generic/math/clc_trunc.cl +++ b/libclc/clc/lib/generic/math/clc_trunc.cl @@ -8,7 +8,8 @@ #include <clc/internal/clc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION __clc_trunc -#define __CLC_BUILTIN __builtin_elementwise_trunc -#include <clc/math/unary_builtin.inc> +#define FUNCTION __clc_trunc +#define __CLC_FUNCTION(x) __builtin_elementwise_trunc +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/acos.cl b/libclc/generic/lib/math/acos.cl index 1efe5eb..85119b4 100644 --- a/libclc/generic/lib/math/acos.cl +++ b/libclc/generic/lib/math/acos.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_acos.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION acos -#include <clc/math/unary_builtin.inc> +#define FUNCTION acos +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/acosh.cl b/libclc/generic/lib/math/acosh.cl index 2accecd..7df6b87 100644 --- a/libclc/generic/lib/math/acosh.cl +++ b/libclc/generic/lib/math/acosh.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_acosh.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION acosh -#include <clc/math/unary_builtin.inc> +#define FUNCTION acosh +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/acospi.cl b/libclc/generic/lib/math/acospi.cl index 844e0aa..d8e7744 100644 --- a/libclc/generic/lib/math/acospi.cl +++ b/libclc/generic/lib/math/acospi.cl @@ -9,7 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_acospi.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION acospi -#include <clc/math/unary_builtin.inc> +#define FUNCTION acospi +#define __CLC_BODY <clc/shared/unary_def.inc> +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/asin.cl b/libclc/generic/lib/math/asin.cl index 360951c..58e4b744 100644 --- a/libclc/generic/lib/math/asin.cl +++ b/libclc/generic/lib/math/asin.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_asin.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION asin -#include <clc/math/unary_builtin.inc> +#define FUNCTION asin +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/asinh.cl b/libclc/generic/lib/math/asinh.cl index 2e2eb57..84ba61d 100644 --- a/libclc/generic/lib/math/asinh.cl +++ b/libclc/generic/lib/math/asinh.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_asinh.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION asinh -#include <clc/math/unary_builtin.inc> +#define FUNCTION asinh +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/asinpi.cl b/libclc/generic/lib/math/asinpi.cl index 7e109e8..bf232ef 100644 --- a/libclc/generic/lib/math/asinpi.cl +++ b/libclc/generic/lib/math/asinpi.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_asinpi.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION asinpi -#include <clc/math/unary_builtin.inc> +#define FUNCTION asinpi +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/atan.cl b/libclc/generic/lib/math/atan.cl index b7d1516..b0a466a 100644 --- a/libclc/generic/lib/math/atan.cl +++ b/libclc/generic/lib/math/atan.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_atan.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION atan -#include <clc/math/unary_builtin.inc> +#define FUNCTION atan +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/atanh.cl b/libclc/generic/lib/math/atanh.cl index d6f6cf7..5d92cdb 100644 --- a/libclc/generic/lib/math/atanh.cl +++ b/libclc/generic/lib/math/atanh.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_atanh.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION atanh -#include <clc/math/unary_builtin.inc> +#define FUNCTION atanh +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/atanpi.cl b/libclc/generic/lib/math/atanpi.cl index 2c67eb9..4337bdf 100644 --- a/libclc/generic/lib/math/atanpi.cl +++ b/libclc/generic/lib/math/atanpi.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_atanpi.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION atanpi -#include <clc/math/unary_builtin.inc> +#define FUNCTION atanpi +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/ceil.cl b/libclc/generic/lib/math/ceil.cl index e58172a..00635dc 100644 --- a/libclc/generic/lib/math/ceil.cl +++ b/libclc/generic/lib/math/ceil.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_ceil.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION ceil -#include <clc/math/unary_builtin.inc> +#define FUNCTION ceil +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/fabs.cl b/libclc/generic/lib/math/fabs.cl index 6fad7de..2723fae 100644 --- a/libclc/generic/lib/math/fabs.cl +++ b/libclc/generic/lib/math/fabs.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_fabs.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION fabs -#include <clc/math/unary_builtin.inc> +#define FUNCTION fabs +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/floor.cl b/libclc/generic/lib/math/floor.cl index 4448e54..d74a50d 100644 --- a/libclc/generic/lib/math/floor.cl +++ b/libclc/generic/lib/math/floor.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_floor.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION floor -#include <clc/math/unary_builtin.inc> +#define FUNCTION floor +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/log1p.cl b/libclc/generic/lib/math/log1p.cl index 8db8c3c..47245d1 100644 --- a/libclc/generic/lib/math/log1p.cl +++ b/libclc/generic/lib/math/log1p.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_log1p.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION log1p -#include <clc/math/unary_builtin.inc> +#define FUNCTION log1p +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/rint.cl b/libclc/generic/lib/math/rint.cl index a33ff91..b844380 100644 --- a/libclc/generic/lib/math/rint.cl +++ b/libclc/generic/lib/math/rint.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_rint.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION rint -#include <clc/math/unary_builtin.inc> +#define FUNCTION rint +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/round.cl b/libclc/generic/lib/math/round.cl index a1495fa..bf1ced1 100644 --- a/libclc/generic/lib/math/round.cl +++ b/libclc/generic/lib/math/round.cl @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> -#include <clc/clcmacro.h> #include <clc/math/clc_round.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION round -#include <clc/math/unary_builtin.inc> +#define FUNCTION round +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/trunc.cl b/libclc/generic/lib/math/trunc.cl index 36ae4c7..d668f39f 100644 --- a/libclc/generic/lib/math/trunc.cl +++ b/libclc/generic/lib/math/trunc.cl @@ -9,6 +9,7 @@ #include <clc/clc.h> #include <clc/math/clc_trunc.h> -#undef __CLC_FUNCTION -#define __CLC_FUNCTION trunc -#include <clc/math/unary_builtin.inc> +#define FUNCTION trunc +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> |
