summaryrefslogtreecommitdiff
path: root/generic/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-05-29 00:42:38 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2012-05-29 00:42:38 +0000
commit33a274aec50983bd9fc96f0e1a302bfdf5b473cd (patch)
tree59551e855c142af078d48026b2007de2dbfdde9a /generic/include
parent39a6da01aa22695d690177600f41448342345c6a (diff)
Implement mad builtin.
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'generic/include')
-rw-r--r--generic/include/clc/clc.h1
-rw-r--r--generic/include/clc/math/gentype.inc51
-rw-r--r--generic/include/clc/math/mad.h2
-rw-r--r--generic/include/clc/math/mad.inc1
4 files changed, 55 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);