native_recip: provide function implementation instead of macro

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318066
This commit is contained in:
Jan Vesely
2017-11-13 18:28:53 +00:00
parent a6758c94ef
commit 1b9825f982
4 changed files with 18 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
#include <clc/clc.h>
#define __CLC_BODY <native_recip.inc>
#define __FLOAT_ONLY
#include <clc/math/gentype.inc>

View File

@@ -0,0 +1,3 @@
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_recip(__CLC_GENTYPE val) {
return 1.0f / val;
}