diff options
| author | Jeroen Ketema <j.ketema@imperial.ac.uk> | 2014-06-13 12:33:40 +0000 |
|---|---|---|
| committer | Jeroen Ketema <j.ketema@imperial.ac.uk> | 2014-06-13 12:33:40 +0000 |
| commit | e2a0f050d8ae9e7985d0a7a4ed05a56340b2c9d6 (patch) | |
| tree | fe5b16cdd8b217fae12a4228a49ec2b153795c42 /libclc | |
| parent | a2e405cb35ad2631e32ae96e57747605f35de7dc (diff) | |
| download | bcm5719-llvm-e2a0f050d8ae9e7985d0a7a4ed05a56340b2c9d6.tar.gz bcm5719-llvm-e2a0f050d8ae9e7985d0a7a4ed05a56340b2c9d6.zip | |
Add files forgotten in the previous commit
llvm-svn: 210896
Diffstat (limited to 'libclc')
| -rw-r--r-- | libclc/generic/lib/math/exp.cl | 8 | ||||
| -rw-r--r-- | libclc/generic/lib/math/exp.inc | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libclc/generic/lib/math/exp.cl b/libclc/generic/lib/math/exp.cl new file mode 100644 index 00000000000..dbf4a930b01 --- /dev/null +++ b/libclc/generic/lib/math/exp.cl @@ -0,0 +1,8 @@ +#include <clc/clc.h> + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + +#define __CLC_BODY <exp.inc> +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/exp.inc b/libclc/generic/lib/math/exp.inc new file mode 100644 index 00000000000..525fb59c996 --- /dev/null +++ b/libclc/generic/lib/math/exp.inc @@ -0,0 +1,10 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE exp(__CLC_GENTYPE val) { + // exp(x) = exp2(x * log2(e)) +#if __CLC_FPSIZE == 32 + return exp2(val * M_LOG2E_F); +#elif __CLC_FPSIZE == 64 + return exp2(val * M_LOG2E); +#else +#error unknown _CLC_FPSIZE +#endif +} |

