[libclc] r258932 - Add _CLC_V_V_VP_VECTORIZE macro

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 06:52:08 PST 2016


Author: tstellar
Date: Wed Jan 27 08:52:07 2016
New Revision: 258932

URL: http://llvm.org/viewvc/llvm-project?rev=258932&view=rev
Log:
Add _CLC_V_V_VP_VECTORIZE macro

Patch by: Pavel Ondra─Źka

Modified:
    libclc/trunk/generic/lib/clcmacro.h

Modified: libclc/trunk/generic/lib/clcmacro.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/clcmacro.h?rev=258932&r1=258931&r2=258932&view=diff
==============================================================================
--- libclc/trunk/generic/lib/clcmacro.h (original)
+++ libclc/trunk/generic/lib/clcmacro.h Wed Jan 27 08:52:07 2016
@@ -109,6 +109,28 @@
   } \
 \
 
+#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
+  DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 *y) { \
+    return (RET_TYPE##2)(FUNCTION(x.x, (ARG2_TYPE*)y), FUNCTION(x.y, (ARG2_TYPE*)y+1)); \
+  } \
+\
+  DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 *y) { \
+    return (RET_TYPE##3)(FUNCTION(x.x, (ARG2_TYPE*)y), FUNCTION(x.y, (ARG2_TYPE*)y+1), \
+                         FUNCTION(x.z, (ARG2_TYPE*)y+2)); \
+  } \
+\
+  DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 *y) { \
+    return (RET_TYPE##4)(FUNCTION(x.lo, (ARG2_TYPE##2*)y), FUNCTION(x.hi, (ARG2_TYPE##2*)((ARG2_TYPE*)y+2))); \
+  } \
+\
+  DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 *y) { \
+    return (RET_TYPE##8)(FUNCTION(x.lo, (ARG2_TYPE##4*)y), FUNCTION(x.hi, (ARG2_TYPE##4*)((ARG2_TYPE*)y+4))); \
+  } \
+\
+  DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 *y) { \
+    return (RET_TYPE##16)(FUNCTION(x.lo, (ARG2_TYPE##8*)y), FUNCTION(x.hi, (ARG2_TYPE##8*)((ARG2_TYPE*)y+8))); \
+  }
+
 #define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
 _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
   return BUILTIN(x, y); \




More information about the cfe-commits mailing list