diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-29 00:42:38 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-29 00:42:38 +0000 |
commit | 33a274aec50983bd9fc96f0e1a302bfdf5b473cd (patch) | |
tree | 59551e855c142af078d48026b2007de2dbfdde9a | |
parent | 39a6da01aa22695d690177600f41448342345c6a (diff) |
Implement mad builtin.
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157599 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | generic/include/clc/clc.h | 1 | ||||
-rw-r--r-- | generic/include/clc/math/gentype.inc | 51 | ||||
-rw-r--r-- | generic/include/clc/math/mad.h | 2 | ||||
-rw-r--r-- | generic/include/clc/math/mad.inc | 1 | ||||
-rw-r--r-- | generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | generic/lib/math/mad.cl | 4 | ||||
-rw-r--r-- | generic/lib/math/mad.inc | 3 |
7 files changed, 63 insertions, 0 deletions
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h index 0e640ba..3b78d29 100644 --- a/generic/include/clc/clc.h +++ b/generic/include/clc/clc.h @@ -38,6 +38,7 @@ #include <clc/math/fabs.h> #include <clc/math/log.h> #include <clc/math/log2.h> +#include <clc/math/mad.h> #include <clc/math/sin.h> #include <clc/math/sqrt.h> #include <clc/math/native_cos.h> diff --git a/generic/include/clc/math/gentype.inc b/generic/include/clc/math/gentype.inc new file mode 100644 index 0000000..4506920 --- /dev/null +++ b/generic/include/clc/math/gentype.inc @@ -0,0 +1,51 @@ +#define GENTYPE float +#include BODY +#undef GENTYPE + +#define GENTYPE float2 +#include BODY +#undef GENTYPE + +#define GENTYPE float3 +#include BODY +#undef GENTYPE + +#define GENTYPE float4 +#include BODY +#undef GENTYPE + +#define GENTYPE float8 +#include BODY +#undef GENTYPE + +#define GENTYPE float16 +#include BODY +#undef GENTYPE + +#ifdef cl_khr_fp64 +#define GENTYPE double +#include BODY +#undef GENTYPE + +#define GENTYPE double2 +#include BODY +#undef GENTYPE + +#define GENTYPE double3 +#include BODY +#undef GENTYPE + +#define GENTYPE double4 +#include BODY +#undef GENTYPE + +#define GENTYPE double8 +#include BODY +#undef GENTYPE + +#define GENTYPE double16 +#include BODY +#undef GENTYPE +#endif + +#undef BODY diff --git a/generic/include/clc/math/mad.h b/generic/include/clc/math/mad.h new file mode 100644 index 0000000..58f7674 --- /dev/null +++ b/generic/include/clc/math/mad.h @@ -0,0 +1,2 @@ +#define BODY <clc/math/mad.inc> +#include <clc/math/gentype.inc> diff --git a/generic/include/clc/math/mad.inc b/generic/include/clc/math/mad.inc new file mode 100644 index 0000000..5200d67 --- /dev/null +++ b/generic/include/clc/math/mad.inc @@ -0,0 +1 @@ +_CLC_OVERLOAD _CLC_DECL GENTYPE mad(GENTYPE a, GENTYPE b, GENTYPE c); diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES index 022abcf..1da1c91 100644 --- a/generic/lib/SOURCES +++ b/generic/lib/SOURCES @@ -7,3 +7,4 @@ integer/abs.cl integer/add_sat.cl integer/add_sat.ll integer/add_sat_impl.ll +math/mad.cl diff --git a/generic/lib/math/mad.cl b/generic/lib/math/mad.cl new file mode 100644 index 0000000..ff0cdbb --- /dev/null +++ b/generic/lib/math/mad.cl @@ -0,0 +1,4 @@ +#include <clc/clc.h> + +#define BODY <mad.inc> +#include <clc/math/gentype.inc> diff --git a/generic/lib/math/mad.inc b/generic/lib/math/mad.inc new file mode 100644 index 0000000..aec9c06 --- /dev/null +++ b/generic/lib/math/mad.inc @@ -0,0 +1,3 @@ +_CLC_OVERLOAD _CLC_DEF GENTYPE mad(GENTYPE a, GENTYPE b, GENTYPE c) { + return a * b + c; +} |