[Beignet] [Patch V2] Enable built-in sub_sat/add_sat vector type.

Ruiling Song ruiling.song at intel.com
Sun Jun 2 21:31:49 PDT 2013


also fix a typo in DECL_VECTOR_20P, DECL_VECTOR_30P macro.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/ocl_stdlib.h |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h
index 613b844..dfba0ba 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -921,7 +921,7 @@ DECL_VECTOR_1OP(__gen_ocl_internal_erfc, float);
 
 #define DECL_VECTOR_2OP(NAME, TYPE) \
   INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE##2 v1) { \
-    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v1.y, v1.y)); \
+    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v0.y, v1.y)); \
   }\
   INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE##3 v1) { \
     return (TYPE##3)(NAME(v0.x, v1.x), NAME(v0.y, v1.y), NAME(v0.z, v1.z)); \
@@ -954,11 +954,28 @@ DECL_VECTOR_2OP(native_divide, float);
 DECL_VECTOR_2OP(copysign, float);
 DECL_VECTOR_2OP(__gen_ocl_internal_maxmag, float);
 DECL_VECTOR_2OP(__gen_ocl_internal_minmag, float);
+
+DECL_VECTOR_2OP(add_sat, char);
+DECL_VECTOR_2OP(add_sat, short);
+DECL_VECTOR_2OP(add_sat, int);
+DECL_VECTOR_2OP(add_sat, long);
+DECL_VECTOR_2OP(sub_sat, char);
+DECL_VECTOR_2OP(sub_sat, short);
+DECL_VECTOR_2OP(sub_sat, int);
+DECL_VECTOR_2OP(sub_sat, long);
+DECL_VECTOR_2OP(add_sat, uchar);
+DECL_VECTOR_2OP(add_sat, ushort);
+DECL_VECTOR_2OP(add_sat, uint);
+DECL_VECTOR_2OP(add_sat, ulong);
+DECL_VECTOR_2OP(sub_sat, uchar);
+DECL_VECTOR_2OP(sub_sat, ushort);
+DECL_VECTOR_2OP(sub_sat, uint);
+DECL_VECTOR_2OP(sub_sat, ulong);
 #undef DECL_VECTOR_2OP
 
 #define DECL_VECTOR_2OP(NAME, TYPE, TYPE2) \
   INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE2##2 v1) { \
-    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v1.y, v1.y)); \
+    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v0.y, v1.y)); \
   }\
   INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE2##3 v1) { \
     return (TYPE##3)(NAME(v0.x, v1.x), NAME(v0.y, v1.y), NAME(v0.z, v1.z)); \
@@ -985,7 +1002,7 @@ DECL_VECTOR_2OP(rootn, float, int);
 
 #define DECL_VECTOR_3OP(NAME, TYPE) \
   INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE##2 v1, TYPE##2 v2) { \
-    return (TYPE##2)(NAME(v0.x, v1.x, v2.x), NAME(v1.y, v1.y, v2.y)); \
+    return (TYPE##2)(NAME(v0.x, v1.x, v2.x), NAME(v0.y, v1.y, v2.y)); \
   }\
   INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE##3 v1, TYPE##3 v2) { \
     return (TYPE##3)(NAME(v0.x, v1.x, v2.x), NAME(v0.y, v1.y, v2.y), NAME(v0.z, v1.z, v2.z)); \
-- 
1.7.9.5



More information about the Beignet mailing list