diff options
author | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-13 18:28:53 +0000 |
---|---|---|
committer | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-13 18:28:53 +0000 |
commit | 1b9825f98264fa4c30add82164db327578dcbdf4 (patch) | |
tree | 8504642b096858475dcb2e69045a584e94a4b1e6 | |
parent | a6758c94ef1a74e363025fdcc6d74a7010e644c9 (diff) | |
download | bcm5719-llvm-1b9825f98264fa4c30add82164db327578dcbdf4.tar.gz bcm5719-llvm-1b9825f98264fa4c30add82164db327578dcbdf4.zip |
native_recip: provide function implementation instead of macro
Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318066
-rw-r--r-- | libclc/generic/include/clc/math/native_recip.h | 10 | ||||
-rw-r--r-- | libclc/generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | libclc/generic/lib/math/native_recip.cl | 5 | ||||
-rw-r--r-- | libclc/generic/lib/math/native_recip.inc | 3 |
4 files changed, 18 insertions, 1 deletions
diff --git a/libclc/generic/include/clc/math/native_recip.h b/libclc/generic/include/clc/math/native_recip.h index 51876614a92..ad81e06da40 100644 --- a/libclc/generic/include/clc/math/native_recip.h +++ b/libclc/generic/include/clc/math/native_recip.h @@ -1 +1,9 @@ -#define native_recip(x) ((1) / (x)) +#define __CLC_BODY <clc/math/unary_decl.inc> +#define __CLC_FUNCTION native_recip +#define __FLOAT_ONLY + +#include <clc/math/gentype.inc> + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index 296c93bc641..94ba4c0621f 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -126,6 +126,7 @@ math/native_exp2.cl math/native_log.cl math/native_log10.cl math/native_log2.cl +math/native_recip.cl math/native_rsqrt.cl math/native_sin.cl math/native_sqrt.cl diff --git a/libclc/generic/lib/math/native_recip.cl b/libclc/generic/lib/math/native_recip.cl new file mode 100644 index 00000000000..bef2deef0b0 --- /dev/null +++ b/libclc/generic/lib/math/native_recip.cl @@ -0,0 +1,5 @@ +#include <clc/clc.h> + +#define __CLC_BODY <native_recip.inc> +#define __FLOAT_ONLY +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/native_recip.inc b/libclc/generic/lib/math/native_recip.inc new file mode 100644 index 00000000000..0d094cabd06 --- /dev/null +++ b/libclc/generic/lib/math/native_recip.inc @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_recip(__CLC_GENTYPE val) { + return 1.0f / val; +} |