[libclc] r211045 - Add all(igentype) builtin
Aaron Watry
awatry at gmail.com
Mon Jun 16 12:53:55 PDT 2014
Author: awatry
Date: Mon Jun 16 14:53:54 2014
New Revision: 211045
URL: http://llvm.org/viewvc/llvm-project?rev=211045&view=rev
Log:
Add all(igentype) builtin
Signed-off-by: Aaron Watry <awatry at gmail.com>
Reviewed-by: Tom Stellard <tom at stellard.net>
Added:
libclc/trunk/generic/include/clc/relational/all.h
libclc/trunk/generic/lib/relational/all.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=211045&r1=211044&r2=211045&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon Jun 16 14:53:54 2014
@@ -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>
Added: libclc/trunk/generic/include/clc/relational/all.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/all.h?rev=211045&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/all.h (added)
+++ libclc/trunk/generic/include/clc/relational/all.h Mon Jun 16 14:53:54 2014
@@ -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)
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=211045&r1=211044&r2=211045&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Jun 16 14:53:54 2014
@@ -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
Added: libclc/trunk/generic/lib/relational/all.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/all.cl?rev=211045&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/all.cl (added)
+++ libclc/trunk/generic/lib/relational/all.cl Mon Jun 16 14:53:54 2014
@@ -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)
More information about the cfe-commits
mailing list