[libclc] 138/291: Add all(igentype) builtin

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit 644b73d1371b2d59a5d9ea1c50b37fc7986198c6
Author: Aaron Watry <awatry at gmail.com>
Date:   Mon Jun 16 19:53:54 2014 +0000

    Add all(igentype) builtin
    
    Signed-off-by: Aaron Watry <awatry at gmail.com>
    Reviewed-by: Tom Stellard <tom at stellard.net>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@211045 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h            |  1 +
 generic/include/clc/relational/all.h | 16 ++++++++++++++++
 generic/lib/SOURCES                  |  1 +
 generic/lib/relational/all.cl        | 29 +++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index f8c1853..23e8049 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -102,6 +102,7 @@
 #include <clc/geometric/normalize.h>
 
 /* 6.11.6 Relational Functions */
+#include <clc/relational/all.h>
 #include <clc/relational/any.h>
 #include <clc/relational/bitselect.h>
 #include <clc/relational/isnan.h>
diff --git a/generic/include/clc/relational/all.h b/generic/include/clc/relational/all.h
new file mode 100644
index 0000000..f917419
--- /dev/null
+++ b/generic/include/clc/relational/all.h
@@ -0,0 +1,16 @@
+
+#define _CLC_ALL_DECL(TYPE) \
+  _CLC_OVERLOAD _CLC_DECL int all(TYPE v);
+
+#define _CLC_VECTOR_ALL_DECL(TYPE) \
+  _CLC_ALL_DECL(TYPE)     \
+  _CLC_ALL_DECL(TYPE##2)  \
+  _CLC_ALL_DECL(TYPE##3)  \
+  _CLC_ALL_DECL(TYPE##4)  \
+  _CLC_ALL_DECL(TYPE##8)  \
+  _CLC_ALL_DECL(TYPE##16)
+
+_CLC_VECTOR_ALL_DECL(char)
+_CLC_VECTOR_ALL_DECL(short)
+_CLC_VECTOR_ALL_DECL(int)
+_CLC_VECTOR_ALL_DECL(long)
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index a35542c..5fc6a4b 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -35,6 +35,7 @@ math/mad.cl
 math/clc_nextafter.cl
 math/nextafter.cl
 math/sincos.cl
+relational/all.cl
 relational/any.cl
 relational/isnan.cl
 shared/clamp.cl
diff --git a/generic/lib/relational/all.cl b/generic/lib/relational/all.cl
new file mode 100644
index 0000000..607d7a9
--- /dev/null
+++ b/generic/lib/relational/all.cl
@@ -0,0 +1,29 @@
+#include <clc/clc.h>
+
+#define _CLC_ALL(v) (((v) >> ((sizeof(v) * 8) - 1)) & 0x1)
+#define _CLC_ALL2(v) (_CLC_ALL((v).s0) & _CLC_ALL((v).s1))
+#define _CLC_ALL3(v) (_CLC_ALL2((v)) & _CLC_ALL((v).s2))
+#define _CLC_ALL4(v) (_CLC_ALL3((v)) & _CLC_ALL((v).s3))
+#define _CLC_ALL8(v) (_CLC_ALL4((v)) & _CLC_ALL((v).s4) & _CLC_ALL((v).s5) \
+                                     & _CLC_ALL((v).s6) & _CLC_ALL((v).s7))
+#define _CLC_ALL16(v) (_CLC_ALL8((v)) & _CLC_ALL((v).s8) & _CLC_ALL((v).s9) \
+                                      & _CLC_ALL((v).sA) & _CLC_ALL((v).sB) \
+                                      & _CLC_ALL((v).sC) & _CLC_ALL((v).sD) \
+                                      & _CLC_ALL((v).sE) & _CLC_ALL((v).sf))
+
+
+#define ALL_ID(TYPE) \
+  _CLC_OVERLOAD _CLC_DEF int all(TYPE v)
+
+#define ALL_VECTORIZE(TYPE) \
+  ALL_ID(TYPE) { return _CLC_ALL(v); } \
+  ALL_ID(TYPE##2) { return _CLC_ALL2(v); } \
+  ALL_ID(TYPE##3) { return _CLC_ALL3(v); } \
+  ALL_ID(TYPE##4) { return _CLC_ALL4(v); } \
+  ALL_ID(TYPE##8) { return _CLC_ALL8(v); } \
+  ALL_ID(TYPE##16) { return _CLC_ALL16(v); }
+
+ALL_VECTORIZE(char)
+ALL_VECTORIZE(short)
+ALL_VECTORIZE(int)
+ALL_VECTORIZE(long)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list