Author: jketema Date: Fri Jun 13 04:40:09 2014 New Revision: 210891 URL: http://llvm.org/viewvc/llvm-project?rev=210891&view=rev Log: Implementations for exp(float) and exp(double) v2
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 <[email protected]> Reviewed-by: Aaron Warty <[email protected]> Reviewed-by: Tom Stellard <[email protected]> Modified: libclc/trunk/generic/include/clc/math/exp.h libclc/trunk/generic/include/clc/math/gentype.inc libclc/trunk/generic/lib/SOURCES Modified: libclc/trunk/generic/include/clc/math/exp.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/exp.h?rev=210891&r1=210890&r2=210891&view=diff ============================================================================== --- libclc/trunk/generic/include/clc/math/exp.h (original) +++ libclc/trunk/generic/include/clc/math/exp.h Fri Jun 13 04:40:09 2014 @@ -1,4 +1,9 @@ #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 Modified: libclc/trunk/generic/include/clc/math/gentype.inc URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/gentype.inc?rev=210891&r1=210890&r2=210891&view=diff ============================================================================== --- libclc/trunk/generic/include/clc/math/gentype.inc (original) +++ libclc/trunk/generic/include/clc/math/gentype.inc Fri Jun 13 04:40:09 2014 @@ -1,4 +1,5 @@ #define __CLC_SCALAR_GENTYPE float +#define __CLC_FPSIZE 32 #define __CLC_GENTYPE float #define __CLC_SCALAR @@ -26,10 +27,12 @@ #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 @@ -57,6 +60,7 @@ #include __CLC_BODY #undef __CLC_GENTYPE +#undef __CLC_FPSIZE #undef __CLC_SCALAR_GENTYPE #endif Modified: libclc/trunk/generic/lib/SOURCES URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=210891&r1=210890&r2=210891&view=diff ============================================================================== --- libclc/trunk/generic/lib/SOURCES (original) +++ libclc/trunk/generic/lib/SOURCES Fri Jun 13 04:40:09 2014 @@ -27,6 +27,7 @@ integer/sub_sat.cl 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 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
