[Beignet] [PATCH 1/2] add built-in function "shuffle2"
Homer Hsing
homer.xing at intel.com
Wed Jul 17 23:48:25 PDT 2013
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
backend/src/ocl_stdlib.h | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h
index e0ae5cc..336b789 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -5539,6 +5539,46 @@ DEF(float)
#undef DEC4
#undef DEC8
#undef DEC16
+
+#define DEC4(TYPE) \
+ INLINE_OVERLOADABLE TYPE##4 shuffle2(TYPE##2 x, TYPE##2 y, uint4 mask) { \
+ TYPE##4 z; \
+ z.s01 = x; \
+ z.s23 = y; \
+ return shuffle(z, mask); \
+ }
+
+#define DEC8(TYPE) \
+ INLINE_OVERLOADABLE TYPE##8 shuffle2(TYPE##4 x, TYPE##4 y, uint8 mask) { \
+ TYPE##8 z; \
+ z.s0123 = x; \
+ z.s4567 = y; \
+ return shuffle(z, mask); \
+ }
+
+#define DEC16(TYPE) \
+ INLINE_OVERLOADABLE TYPE##16 shuffle2(TYPE##8 x, TYPE##8 y, uint16 mask) { \
+ TYPE##16 z; \
+ z.s01234567 = x; \
+ z.s89abcdef = y; \
+ return shuffle(z, mask); \
+ }
+#define DEF(TYPE) \
+ DEC4(TYPE) \
+ DEC8(TYPE) \
+ DEC16(TYPE)
+DEF(char)
+DEF(uchar)
+DEF(short)
+DEF(ushort)
+DEF(int)
+DEF(uint)
+DEF(float)
+#undef DEF
+#undef DEC4
+#undef DEC8
+#undef DEC16
+
/////////////////////////////////////////////////////////////////////////////
// Vector loads and stores
/////////////////////////////////////////////////////////////////////////////
--
1.8.1.2
More information about the Beignet
mailing list