Use separate implementations instead of a macro
to ensure the constant multiplied with is of
higher precision.
v2: Use the correct formula, spotted by Dan Liew <daniel.liew@imperial.ac.uk>
Reviewed-by: Aaron Warty <awatry@gmail.com>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 210891
#undef exp
-// exp(x) = exp2(x * log2(e)
-#define exp(val) (__clc_exp2((val) * 1.44269504f))
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION exp
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
#define __CLC_SCALAR_GENTYPE float
+#define __CLC_FPSIZE 32
#define __CLC_GENTYPE float
#define __CLC_SCALAR
#include __CLC_BODY
#undef __CLC_GENTYPE
+#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#ifdef cl_khr_fp64
#define __CLC_SCALAR_GENTYPE double
+#define __CLC_FPSIZE 64
#define __CLC_SCALAR
#define __CLC_GENTYPE double
#include __CLC_BODY
#undef __CLC_GENTYPE
+#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#endif
integer/sub_sat_if.ll
integer/sub_sat_impl.ll
integer/upsample.cl
+math/exp.cl
math/fmax.cl
math/fmin.cl
math/hypot.cl