diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-29 13:35:28 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-29 13:35:28 +0000 |
commit | 0d9bead544e7bd9b7312989dffe9e73c95810542 (patch) | |
tree | b59aa359d8813b54be8fa9a4b918fc1d08e73ec5 /generic/lib | |
parent | 33a274aec50983bd9fc96f0e1a302bfdf5b473cd (diff) |
Add fma, hypot builtins.
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'generic/lib')
-rw-r--r-- | generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | generic/lib/math/hypot.cl | 8 | ||||
-rw-r--r-- | generic/lib/math/hypot.inc | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES index 1da1c91..0608116 100644 --- a/generic/lib/SOURCES +++ b/generic/lib/SOURCES @@ -7,4 +7,5 @@ integer/abs.cl integer/add_sat.cl integer/add_sat.ll integer/add_sat_impl.ll +math/hypot.cl math/mad.cl diff --git a/generic/lib/math/hypot.cl b/generic/lib/math/hypot.cl new file mode 100644 index 0000000..dcdc1ed --- /dev/null +++ b/generic/lib/math/hypot.cl @@ -0,0 +1,8 @@ +#include <clc/clc.h> + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + +#define BODY <hypot.inc> +#include <clc/math/gentype.inc> diff --git a/generic/lib/math/hypot.inc b/generic/lib/math/hypot.inc new file mode 100644 index 0000000..3f529c8 --- /dev/null +++ b/generic/lib/math/hypot.inc @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF GENTYPE hypot(GENTYPE x, GENTYPE y) { + return sqrt(x*x + y*y); +} |